Hi,
In message "gsub() replacement containing replaced text"
on 02/07/13, Harry Ohlsen <harryo / zip.com.au> writes:
|I want to replace all single quotes in a string with backslask followed by a
|single quote. The obvious approach doesn't seem to work, presumably because
|the replacement contains the pattern that's been replaced.
"\\'" in a replacement string is substitute by the value of $', so you
have to say
x.gsub("'", "\\\\'")
matz.