Andreas Schwarz wrote: > I wanted to do a simple string substitution, and was surprised to see > that there isn't such a method in ruby. I can't use String::(g)sub, > because the substitution mustn't be influenced by special chars or > backreferences in the pattern and replacement strings. Of course I could > write functions to escape regex special chars in the pattern and > backreferences in the replacement string, but this is about the ugliest > solution I can think of. There's a subliminate message here... irb(main):006:0> a = "dave" => "dave" irb(main):007:0> a["av"] = "onat" => "onat" irb(main):008:0> a => "donate"