J
John Woods
The following confusing behavior is noted in the pickaxe book (2nd ed)
on page 75:
# I would expect two backslashes in the result
irb> puts "\\".gsub("\\","\\\\")
\
# I would expect four backslashes in the result
irb> puts "\\".gsub("\\","\\\\\\\\")
\\
I can certainly work around it, but it seems unintuitive. Is there a
reason why gsub behaves this way? Just curious...
on page 75:
# I would expect two backslashes in the result
irb> puts "\\".gsub("\\","\\\\")
\
# I would expect four backslashes in the result
irb> puts "\\".gsub("\\","\\\\\\\\")
\\
I can certainly work around it, but it seems unintuitive. Is there a
reason why gsub behaves this way? Just curious...