in reply to In substituation regex, how to differentiate \1 from surrounding text

On the replacement side, that isn't a regex, that's a double-quoted string, and you should be using $1 instead of \1. So, in this case, a simple ${1} will work.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: In substituation regex, how to differentiate \1 from surrounding text

Replies are listed 'Best First'.
Re^2: In substituation regex, how to differentiate \1 from surrounding text
by Roy Johnson (Monsignor) on May 19, 2004 at 21:30 UTC
    And on the pattern side, you can put it in non-capturing parentheses.

    The PerlMonk tr/// Advocate