From: Rolando Abarca Date: 2007-11-20T04:00:35+09:00 Subject: Re: Scraping from a website On Nov 19, 2007, at 3:45 PM, cskilbeck wrote: > Hi, > > I need to extract everything between
and
on a website > (there's only one table on the page. So far I have: > > require 'open-uri' > page = open('http://xxx.html').read > page.gsub!(/\n/,"") > page.gsub!(/\r/,"") > inner = page.scan(%r{.*(.*).*}m) > print inner > > but inner is empty - any ideas? > > If I substitute line 2 with > > page = '123456
789 > > I get inner = 456, which is correct. use the right tools for the right job :-) require 'hpricot' require 'open-uri' doc = Hpricot(open('http://xxx.html')) table = doc.at('table') puts table.inner_html (not tested) regards, -- Rolando Abarca Phone: +56-9 97851962