Re: bug in ruby 1.9.2-p0 gsub?

---- Sd He [email protected] wrote:

Why does the following only replace the first instance of the pattern?

‘|\ |\ |’.gsub(/|\ |/, “||”)

Because “\ |” will not match “|\ |”.

If you had made it ‘|\ ||\ |’, both will be replaced and you would have
had “||||”

-GregD