in reply to Re^2: Issue with matching regex
in thread Issue with matching regex

Thanks choroba,

I didn’t know that! This special case must have been implemented for a reason, but I can’t think what it could have been.

Using a non-capturing group to avoid this behaviour is a useful workaround.

The good news is that this special case doesn’t seem to be present in Raku:

23:48 >perl -wE "my $s = ''; say 'match1' if 'abc' =~ /b/; say 'match2 +' if 'adc =~ /(?:$s)/;" match1 match2 23:55 >perl -wE "my $s = ''; say 'match1' if 'abc' =~ /b/; say 'match2 +' if 'adc =~ /$s/;" match1 23:56 >raku -e "my Str $s = ''; say 'match1' if 'abc' ~~ /b/; say 'mat +ch2' if 'adc' ~~ /$s/;" match1 match2 23:56 >

Cheers,

Athanasius <°(((><contra mundum סתם עוד האקר של פרל,