Why I can't substitute with '\\+' inside a string with gsub?
- by Vítor Baptista
Try the following code:
s = '#value#'
puts s.gsub('#value#', Regexp.escape('*')) # = '*'
puts s.gsub('#value#', Regexp.escape('+')) # = ''
Wtf? It looks like the char '\+' (returned by Regexp.escape) is completely ignored by gsub. How to fix this?