From: Glen Holcomb Date: 2008-08-15T03:26:10+09:00 Subject: Re: Inconsistent regexp behavior ------=_Part_124336_10773734.1218738537186 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Aug 14, 2008 at 11:01 AM, Glen Holcomb wrote: > 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) > Thanks guys, now I know why. -- "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_124336_10773734.1218738537186--