I'm executing the following code:

 "a b c".sub("b", "believe\\+me")

And I get "a believeme c" in return. That's bad: Where have the two
characters, "\\+", gone?

I suspect it has to do with the RegExp replacement patterns \1 and so
on: since \+ isn't valid, it's removed. I thought sub() would notice
that "b" isn't a regexp and won't trip me on this nonsense.

So, what's the correct way to replace plain strings in Ruby?

-- 
Posted via http://www.ruby-forum.com/.