From: "Peña, Botp" Date: 2008-08-15T09:44:34+09:00 Subject: Re: Inconsistent regexp behavior From: Glen Holcomb [mailto:damnbigman@gmail.com] # puts "toads suck".gsub(/(\s)/, "\\#{$1}") # toads\suck # Can anyone explain why this is happening. I'm convinced it # shouldn't ever happen. it's a common surprise, but ruby has a solution for that; try the block form irb(main):002:0> puts "toads suck".gsub(/(\s)/) { "\\#{$1}" } toads\ suck => nil no surprise. kind regards -botp