R
Ralph Shnelvar
[Note: parts of this message were removed to make it a legal post.]
Consider the string
\1\2\3
that is
"\\1\\2\\3"
I feel really stupid ... but this simple substitution pattern does not do what I expect.
"\\1\\2\\3".gsub(/\\/,"\\\\")
What I want is to change single backslashes to double backslashes. The result of the above substitution is "no change"
On the other hand
"\\1\\2\\3".gsub(/\\/,"\\\\\\\\")
does do what I want ... but I am clueless as to why.
Consider the string
\1\2\3
that is
"\\1\\2\\3"
I feel really stupid ... but this simple substitution pattern does not do what I expect.
"\\1\\2\\3".gsub(/\\/,"\\\\")
What I want is to change single backslashes to double backslashes. The result of the above substitution is "no change"
On the other hand
"\\1\\2\\3".gsub(/\\/,"\\\\\\\\")
does do what I want ... but I am clueless as to why.