> Turns out that \' is a regex interpolator, just like \1, \2, so
> "a'b'c'd".gsub("'","\\'") did not work, nor did it with the 2nd param as
> '\\\\''.

The backslash in the string is first interpreted by ruby and then as
regexp substitution pattern. This \\x becomes \x as substitution
pattern but that really is just x then because there is no special
substitution for \x. In order to replace x with \x, the substitution
has to be \\x but since this is a string parsed by ruby before it gets
there you have to escape those backslashes and make it "\\\\x".

It really isn't that surprising but I agree that it would be nice to
have a special string syntax that disables any special handling of
backslashes so that you could write %X{\'}. I don't think such a
syntax exists, does it?

-- 
Leo

The end is here -->