John Joyce
8/17/2007 10:00:00 PM
On Aug 17, 2007, at 8:59 AM, Tim Pease wrote:
> On 8/17/07, Haze Noc <h4z3@the-c0re.org> wrote:
>> mysite.each {|line|
>> if line =~ /<p><a href="(.+)"><b>(.+)<\/b>/
>> puts "#{$2} found at: #{$1}"
>> end
>> }
>>
>> Ok guys, Lets say the website has 50+ lines.. and i only want to
>> return
>> the first one, any ideas?
>
> %r/^(.*)$/.match(mysite)[1]
>
Careful,
What if the site's white space has been stripped? (no CR or LF at all)
or if the html/xhtml is screwy? (old html without closed elements,
or just poorly formed or badly nested)