From: Robert Klemme Date: 2008-08-10T23:42:52+09:00 Subject: Re: Regex. How to return multiple lines On 10.08.2008 15:49, Sebastian Hungerecker wrote: > Robert Klemme wrote: >> c = File.read "x" >> >> p c.grep /a+/ > > Why not: > p File.open("x") {|f| f.grep /a+/} > Avoids loading the whole file into memory. The original request stated "I assume that file would be read in one chunk into memory." which I choose to respect. But see my disclaimer at the end and also my other reply that hinted at this. Cheers robert