H
Hoppy
str = "$$$$$$$$"
str.gsub(/([$(&])/, '/\1') # => "/$/$/$/$/$/$/$/$"
Now how do I return this instead: "\$\$\$\$\$\$\$\$"?
# each matched character preceded by a single backslash
I've looked up http://rubygarden.org/ruby?RegexpCookbook for clues but
that "multitude of backslashes" isn't clear to me at this point.
(Using ruby 1.8.4 (2005-12-24) [i386-cygwin])
str.gsub(/([$(&])/, '/\1') # => "/$/$/$/$/$/$/$/$"
Now how do I return this instead: "\$\$\$\$\$\$\$\$"?
# each matched character preceded by a single backslash
I've looked up http://rubygarden.org/ruby?RegexpCookbook for clues but
that "multitude of backslashes" isn't clear to me at this point.
(Using ruby 1.8.4 (2005-12-24) [i386-cygwin])