From: Paul Battley Date: 2006-07-29T06:52:55+09:00 Subject: Re: Finding "\" in a string On 28/07/06, Eric Armstrong wrote: > I'm going crazy, right? Surely it is possible > to find a backslash (\) in a string, and > replace it with two backslashes. That's simple, > right? Just gsub("\\", '\\'). That's all there > is to it. You're not going crazy. You just need eight of 'em. Yes, really! testpath = "\\foo\\bar" result = testpath.gsub("\\", "\\\\\\\\") p result # => "\\\\foo\\\\bar" Paul.