From: Benoit Daloze Date: 2010-10-10T03:24:05+09:00 Subject: Re: Better way to remove all occurrence of matches on a String On 9 October 2010 19:30, Harry Kakueki wrote: >> >> What feels a bit "awkward" to me in the first approach is to specify I >> want no replacement (so nothing, so I should not have to specify it). >> > > If you *really* want to avoid a second parameter, you could try > something like this. > But, I would not actually say it is better. > Anyway.... > > > str = "foo bar foo bar foo" > p str.split(/\bbar\b/)*"" > > > Harry Nice one, but I guess the extra parameter is not too bad compared to this :)