From: Ben Date: 2008-03-25T08:15:14+09:00 Subject: Re: Replacing part of a matched regular expression using gsub Hi Jesus, > Hi, it works for me: > > irb(main):009:0> replacement = "\\1102\\3," > => "\\1102\\3," > irb(main):010:0> word = "qweraxbtyuiop" > => "qweraxbtyuiop" > irb(main):011:0> word.gsub!(Regexp.new("(a)(x)(b)"), replacement) > => "qwera102b,tyuiop" > > Hope this helps, > > Jesus. Thank you! Actually, that did help, as it made me realise that what I needed to do was try it out in irb. I got it to work now - thanks! (For the record, the problem was that rule.getRegExp was returning "(a)x(b)" instead of "(a)(x)(b)"). Ben