From: Robert Dober Date: 2009-08-18T16:15:56+09:00 Subject: Re: Reading contents of a file and storing 2009/8/17 Joel VanderWerf : > Robert Dober wrote: >> >> On Mon, Aug 10, 2009 at 9:20 PM, Joel VanderWerf >> wrote: >>> >>> source.gsub(/^([^=]+)=/) {$1 + " "} >> >> I was just wondering, should we not refuse to use ^ for the beginning >> of a string ( even knowing it is a line )? I personally have abandoned >> ^ for \A for quite some time now. Is nobody going to follow ;). > > Didn't the OP want each line converted? It's getting hard to remember... > Anyway, I did mean ^ in my answer, but maybe I was confused about the > question. > Sorry my bad. I did not realize from the snippet that you were doing the whole source in one thing. But I should have, given the *g*sub. Yes of course you need to use ^. As a matter of fact my point was not to use it on lines, because ^ matches at the beginning of a *line* while when we are treating lines there are no lines anymore and we want to match at the beginning of a *string*, hence \A. Cheers Robert