I inherited some perl 5 (5.20) code, which contains a regular expression with the operator ?>!. Unfortunately, I have been unable to find any documentation on what this operator is doing at all, in man perlre
only ?> is documented.
Can anyone explain to me when the regex in the example code matches/doesn't match?
my $text = "powergenerator";
if ($text =~ m/generator(?>!power)/) {
print "MATCH\n";
} else {
print "NO MATCH\n";
}
There is a comment in the original code that the intended use case is that generator is matched when it is not the context of powergenerator, but, according to my tests, this is not what happens. Note: The code only cares about whether the regex matches or not, it does not process the match location.