From: steve@... Date: 2008-03-01T13:53:42+09:00 Subject: Re: Scan HTML Google Hipricot and Mechanize!!! Sent from my Verizon Wireless BlackBerry -----Original Message----- From: William James Date: Sat, 1 Mar 2008 13:49:59 To:ruby-talk@ruby-lang.org (ruby-talk ML) Subject: Re: Scan HTML On Feb 29, 9:22 pm, Tom Arra wrote: > So I am new to Ruby scripting so I am not sure if this is possible or > not. I want to make a script that will load a webpage and then search > through the HTML of that page until it hits a certain tag. Once it hits > that tag it need to grab all of the text between the tag and the > appropriate end tag. Is something like this possible? > > Example > > >

test

> > > > I want the script to return "test" > -- > Posted viahttp://www.ruby-forum.com/. require 'net/http' puts Net::HTTP.new('www.google.com').get('/'). body[ %r{(.*?)}mi, 1 ] If the tag can contain attributes, e.g., : require 'net/http' puts Net::HTTP.new('www.google.com').get('/'). body[ %r{<title(?:\s*|\s+.*?)>(.*?)</title\s*>}mi, 1 ]