From: Glen Holcomb Date: 2008-08-15T02:01:29+09:00 Subject: Re: Inconsistent regexp behavior ------=_Part_123036_21126037.1218733455768 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Aug 14, 2008 at 10:40 AM, Glen Holcomb wrote: > I have a script with two lines: > > puts "toads suck".gsub(/(\s)/, "\\#{$1}") > > puts " a ".gsub(/(\s), "\\#{$1}") > > > I get broken output for the first: > > toads\suck > > \ a\ > > Can anyone explain why this is happening. I'm convinced it shouldn't ever > happen. > > -- > "Hey brother Christian with your high and mighty errand, Your actions speak > so loud, I can't hear a word you're saying." > > -Greg Graffin (Bad Religion) > Oops. Typo, I should probably copy and paste next time. The second gsub is actually: puts " a ".gsub(/(\s)/, "\\#{$1}") -- "Hey brother Christian with your high and mighty errand, Your actions speak so loud, I can't hear a word you're saying." -Greg Graffin (Bad Religion) ------=_Part_123036_21126037.1218733455768--