H
Haakon Riiser
I just noticed that backreferences in qr-regexes behave differently
from what I expected when they are interpolated into a new regex.
I expected that the meaning of the backreference shouldn't change
when interpolated into a new regex. I.e., one should be able to
do things like:
$re1 = qr{(.)\1};
$re2 = qr{($re1$re1)};
which I would expect to be equivalent to
$re2 = qr{((.)\2(.)\3)};
Perl 5.8.3 instead does this:
$re2 = qr{((.)\1(.)\1)};
I searched for the problem on Google, and found that it has been
known for at least three years. Since it's still here, does that
mean that there's another solution that does not require me to
drop the interpolation and write the entire regex as one big chunk?
Thanks in advance for any replies.
from what I expected when they are interpolated into a new regex.
I expected that the meaning of the backreference shouldn't change
when interpolated into a new regex. I.e., one should be able to
do things like:
$re1 = qr{(.)\1};
$re2 = qr{($re1$re1)};
which I would expect to be equivalent to
$re2 = qr{((.)\2(.)\3)};
Perl 5.8.3 instead does this:
$re2 = qr{((.)\1(.)\1)};
I searched for the problem on Google, and found that it has been
known for at least three years. Since it's still here, does that
mean that there's another solution that does not require me to
drop the interpolation and write the entire regex as one big chunk?
Thanks in advance for any replies.