From: "yermej@..." Date: 2007-08-18T08:25:14+09:00 Subject: Re: Return first line of parsing On Aug 17, 8:52 am, Haze Noc wrote: > mysite.each {|line| > if line =~ /

(.+)<\/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? > -- > Posted viahttp://www.ruby-forum.com/. If you want to use essentially the same block as above, but just take the first matching line: mysite.each {|line| if line =~ /

(.+)<\/b>/ puts "#{$2} found at: #{$1}" break end } Tim's solution would give you the first line of the actual html file and, as John mentions, that could be the entire web page if there are no CR/LF characters in the file. Jeremy