re-engine-RE2
re-engine-RE2 copied to clipboard
Matching against some patterns does not terminate
If the pattern is such that it should successfully match the empty string, then matching against the pattern in list context with the global modifier set does not terminate. For example:
my $s = "tood";
my $p = "a*";
my @m = $s =~ /$p/g;
In Perl, the above yields an array of $n + 1 empty strings, where $n is the length of $s. When using RE2, the above does not terminate and causes the machine to run out of memory.