Thomas Hurst (tom.hurst / clara.net) wrote:


 > The correct way to talk about backreferences is the traditional \
 > operator:
 >
 >
 > line.sub!(/(str)ing/,'\1')
 >
 > Since this is evaluated by the regexp engine rather than the string
 > object.
 >
 >
 > Remember you need to escape it in double quotes, i.e. "\\1".

This works. I just need to do a better job of RTFM. I was using the
Nutshell book, which does not mention this. But "Programming Ruby" and
the manual both mention this.

Thanks!

Kirk