Re: Substitution, subgroups and numbers

"Patrick Mezard" <[email protected]> Wed, 18 Dec 2002 20:31:33 +0100
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <002e01c2a6cc$12e916c0$2100a8c0@trick2k>
Thank you for answering so quickly.

>The use of braces is part of Perl variable expansion.  It does not
>directly have anything to do with regular expressions, which is why
>it is not implemented.  The approach taken in jakarta-oro's Perl5
>regular expression implementation has generally been to only include
>those features that strictly have to do with Perl regular expressions
>and not the Perl scripting/shell.

I understand that. The problem, is that this kind of interpolation is really
simple and may happen regularly, so it would be great to be able to write it
in a way or another (even if it requires to use a non-perlish trick, since
perl is no help there). As I said before the following substitution string
happened to work in this case:

"$1\\2"  (instead of  "${1}2"}

Is this a normal behavior (as I stated I failed to make it work with perl,
but nobody's perfect) or a transient bug in the escaping process ? I tried
it with former versions (1.1 and 2.0) and it didn't work.

Trick