Norbert Koch wrote: > I've successfully tried > puts s.gsub("'", "\\\\'") >> yadda\'yadda\'yadda Me too. On ruby 1.7.0 (2001-04-02) [i686-cygwin] checked out from CVS and built this morning I get this: s = "yadda'yadda'yadda" s.gsub(/'/, "\\'") >> yaddayadda'yaddayaddayaddayadda s.gsub(/'/, "\\\'") >> yaddayadda'yaddayaddayaddayadda s.gsub(/'/, "\\\\'") >> yadda\\'yadda\\'yadda puts s.gsub("'", "\\\\'") >> yadda\'yadda\'yadda Why the difference between s.gsub(...) and puts s.gsub(...)? t=s.gsub(/'/,"\\\\'") >> "yadda\\'yadda\\'yadda" t.type >> String puts t >> yadda\'yadda\'yadda Note that the result for t -- and for s.gsub(/'/,"\\\\'"), directly -- is displayed in double quotes. The backslash is a special character that gets represented within a String as escaped; hence the second "\" in the visible representation. When presented by puts, the output does not have to be represented as a quoted string. At least I think this is what's going on here. Ruby newbie, ... Hey! That's poetry in motion! John Tobler grepninja / diganet.com