From: Robert Klemme Date: 2012-03-05T23:10:44+09:00 Subject: Re: Reading particular text from a txt file Lekha Selvaraj wrote in post #1050195: > Here you go The line you look for is in line 10 and not 8. From your initial posting it seemed the line was fixed. def r(f) File.foreach f do |line| match = line[/^CRP\+TYH\+(\d+)/, 1] and return match end nil end Cheers robert -- Posted via http://www.ruby-forum.com/.