From: Alexey Bovanenko Date: 2009-10-13T15:14:32+09:00 Subject: Re: remove specific text from line It's because I put line myInst.test("Time@110.075: EVENT: [LOG] *** DEBUG ACTION ***"); There's string literal: "Time@110.075: EVENT: [LOG] *** DEBUG ACTION ***" If you want parse file content you must read lines and put it to method: File.open("fname.txt").each do |line| myInst.test(line) end On Tue, Oct 13, 2009 at 1:09 AM, Collin Moore wrote: > Alexey Bovanenko wrote: >> Hi! >> >> I think you can use the following solution: >> >> class TestClass >>   def test(val) >>     val.scan(/^[^@]+@(\d{1,3}\.\d{1,3})[^*]+\*{3}\s*([^*]+)/) do >>       puts $1+" : "+$2 >>     end >>   end >> end >> >> myInst=TestClass.new >> myInst.test("Time@110.075: EVENT: [LOG] *** DEBUG ACTION ***"); >> >> The result is: 110.075 : DEBUG ACTION > > I tried this and 110.075 : DEBUG ACTION repeats for all the lines in the > output. > > -- > Posted via http://www.ruby-forum.com/. > >