From: Paul Lutus Date: 2006-11-12T09:30:08+09:00 Subject: Re: parsing html table cells lrlebron@gmail.com wrote: > I am trying to parse an html page that has strings that looks like this > > align="left">447119 to > get the numbers inside the table cells. > > I would to end up with a simple string that looks like this (for this > row) > 4 47 1 19 > > The number of table cells in a row that have numbers may vary for > different rows. Try this: ------------------------------------- #!/usr/bin/ruby -w table = "" + "" + "" + "" + "
447119
749439
14171921
" rows = table.scan(%r{.*?}) rows.each do |row| fields = row.scan(%r{(.*?)}) puts fields.join(",") end ------------------------------------- Output: 4,47,1,19 7,49,4,39 14,17,19,21 -- Paul Lutus http://www.arachnoid.com