From: petermichaux@... Date: 2006-04-02T06:28:46+09:00 Subject: Re: Regexp grouping question Chris Alfeld wrote: > compressed = "foo = bar; red = herring;" > compressed = compressed.gsub(/\s*([=;])\s*/,'\1') > > I believe #$1 is evalued *before* gsub is executed and hence fails. > gsub sets the variable and uses \1, \2, \3 in the replacement string > to correspond. Thank you! Peter