On 27 Sep 2000, Piers Cawley wrote:
> > Do we *want* to maintain \1? Why have two notations to do the
>
> I'm kind of curious about what happens when you want to do, say:
>
> if (m/(\S+)/) {
> $reg = qr{<(em|i|b)>($1)</\1>};
> }
>
> where the $1 in the regex quote is refering to $1 from the previous
> regex match.
Well, how about this:
$reg = qr{<(em|i|b)>(${P1})</\1>};
NOTE: ^^^^^
If you assume that $1 and ${1} are equivalent (which makes it
possible to have as many backrefs as you want), then you could say that,
if the first character after the { is a P, it means "in the previous regex
match."
Dave