From: Mike Bowler Date: 2001-03-06T20:50:24+09:00 Subject: [ruby-talk:12116] String.gsub() The method String.gsub() isn't working the way I expected (or the way the pickaxe book describes it for that matter). Given this code: def replaceSingleQuotesWithDouble( inputString ) puts "original="+inputString puts inputString.gsub(/'(.+)'/, "\"\1\"") end replaceSingleQuotesWithDouble("foo 'bar' foo") I would expect the output to be foo "bar" foo Instead I get foo "" bar The match is successful but it seems that the variable \1 hasn't been assigned by the time we are doing the substitution. Am I doing something wrong? BTW gsub! seems to behave in the same way. Mike mbowler@GargoyleSoftware.com