From: Tom Arra Date: 2008-03-01T22:56:02+09:00 Subject: Re: Scan HTML Tom Arra wrote: > William James wrote: >> On Feb 29, 9:22 pm, Tom Arra wrote: >>> >>> >>> >>> 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 ] > > So far I think this is closest to what I am looking for. I need to go to > a website that has a server information and pull that out of the HTML. > Then take that info and spit it back out to the user. If I am > understanding the code above, it at least does the first part which I > had no clue how to do. Well I just tried it and it worked like a charm. My next thing is to limit what it brings back. Example <h3>blah blah blah 7.0.0.3.4 blah blah blah</h3> I want to pull just the 7.0.0.3.4 and none of the words. I am sure this is going to have to deal with more regular expressions but I never really understood how to use them well. -- Posted via http://www.ruby-forum.com/.