On Sun, Nov 21, 2010 at 11:02 PM, Brian Candler <b.candler / pobox.com> wrote: > Ralph Shnelvar wrote in post #962847: >> "\\1\\2\\3".gsub(/\\/,"\\\\") > > Here you are replacing one backslash with one backslash. > > The trouble is, in the *replacement* string, '\1' has a special meaning > (insert the value of the first capture). Because of this, a literal > backslash is backslash-backslash. That's a keen observation, but the fact that they happen to be back-references doesn't seem to play a part in this situation. >> "\\a\\b\\c".gsub(/\\/,"\\\\") => "\\a\\b\\c" >> "\\a\\b\\c".gsub(/\\/,"\\\\\\") => "\\\\a\\\\b\\\\c" Regards, Ammar