From: Greg Ditrick Date: 2010-11-10T02:14:27+09:00 Subject: Re: bug in ruby 1.9.2-p0 gsub? ---- Sd He 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