From: Radek Hnilica Date: 2002-12-19T18:55:36+09:00 Subject: Re: Few question about IO On Thu, Dec 19, 2002 at 06:38:16PM +0900, Greg Millam wrote: > My bad - need to escape those. > > \\1 and \\2 > > irb(main):032:0> ": dbl dup + ;".gsub(%r[(\s|^)\+(\s|$)], %Q[\\1:plus:\\2]) Thanks much. Now it works def mangle(s, dict) dict.each_pair do |key,id| word = Regexp.quote(key) s.gsub!(%r[(\s|^)#{word}(\s|$)], %Q[\\1\\2]) s.gsub!(%r[(\s|^)#{word}(\s|$)], %Q[\\1\\2]) end s end -- Radek Hnilica ======================================= No matter how far down the wrong road you've gone, turn back. Turkish proverb