E
Eric Niebler
Consider the following program:
$str = 'aaA';
$str =~ /(((?:a))?)+/i;
if(defined($2)) { print "$2"; }
else { print "not defined"; }
This prints "not defined," and I think that's right. But if I change the
regex to /(((a))?)+/i (that is, if I change the third group from
non-capturing to capturing), the program prints "A".
I can't think of a reason why changing group 3 from non-capturing to
capturing should have any effect on whether group 2 captures anything.
Seems like a regex bug to me. Opinions?
FWIW, I'm running ActiveState perl v5.8.7 815 for Win32.
Thanks,
Eric
$str = 'aaA';
$str =~ /(((?:a))?)+/i;
if(defined($2)) { print "$2"; }
else { print "not defined"; }
This prints "not defined," and I think that's right. But if I change the
regex to /(((a))?)+/i (that is, if I change the third group from
non-capturing to capturing), the program prints "A".
I can't think of a reason why changing group 3 from non-capturing to
capturing should have any effect on whether group 2 captures anything.
Seems like a regex bug to me. Opinions?
FWIW, I'm running ActiveState perl v5.8.7 815 for Win32.
Thanks,
Eric