From: Luke Pearce Date: 2012-09-01T00:50:26+09:00 Subject: Can someone explain this regex issue to me? Using 1.9.3p194: > puts "\+" + > puts "\\+" \+ > puts "\\" \ However not what I'd expect (1): > puts "hi + bye".gsub(/\+/, "\\+") hi bye This gives the expected output: > puts "hi + bye".gsub(/\+/, "\\\\+") hi \+ bye I can understand why I need to double escape the + to get \+ in the output but shouldn't (1) above at least print "hi + bye"? -- Posted via http://www.ruby-forum.com/.