in reply to This regex surprised me
Printing the pre-compiled regex, I get:
3:05 >perl -wE "my $q = qr/^ab$/; say $q;" (?^u:^ab$) 3:06 >
and from perlre#Extended-Patterns it appears that this is equivalent to (?ud-imsx:^ab$), which explicitly turns off the m modifier throughout of the embeded pattern-match modifier. So adding /m to the regex has no effect, because it is overridden within the (?-m:...) construct inside the regex.
I don’t know how all this worked in earlier versions of Perl, but in recent versions, it seems you have to add the /m modifier when the regex is first constructed using qr//:
my $qre = qr/^ab$/m;
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|