From: Jano Svitok Date: 2007-12-07T01:33:30+09:00 Subject: Re: if /hello/ =~line On Dec 6, 2007 4:35 PM, yermej wrote: > You can also use the /o option, which tells Ruby to compile the Regex > only once: > > var = "hello" > File.foreach "file.txt" do |line| > if /#{var}/o =~ line > > puts "found it" > break > end > end > > Thanks, I didn't know that... Now I see it even in the first pickaxe book... I guess I should read it once more ;-)