in reply to match with exception
The look-ahead assertion is inside the (?!). Read the perl documentation about this feature - it is tricky and does not always work as expected (but it does work as designed!)my $s = "abcxyQ"; if ($s =~ /abc(?!xyz)/) { print "Matches '$s'\n"; } else { print "Doesn't Match '$s'\n"; } my $t = "abcxyz"; if ($t =~ /abc(?!xyz)/) { print "Matches '$t'\n"; } else { print "Doesn't Match '$t'\n"; }
|
|---|