From: cskilbeck Date: 2007-11-20T06:00:15+09:00 Subject: Re: Scraping from a website On Nov 19, 7:14 pm, William James wrote: > On Nov 19, 12:41 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. > > inner = page[ %r{(.*?)}mi, 1] Thanks all for your help. non greedy matching is the key.