From: Philip Mak Date: 2002-09-29T06:10:11+09:00 Subject: Re: gsub can't add a single backslash? On Sat, Sep 28, 2002 at 04:54:55PM -0400, Philip Mak wrote: > irb(main):016:0> '&'.gsub(/&/, "\\\&") > "&" > irb(main):017:0> '&'.gsub(/&/, "\\\\&") > "\\&" > > Have I stumbled upon a bug? It refuses to add a single backslash; > always zero or two. Never mind, I was just reading it wrong. "\\&" is actually '\&'; it's just the way irb displays strings.