Consider this script:
#!/usr/bin/perl use strict; use warnings; use Benchmark qw(timethis); my $str = 'a' x shift; timethis(1, sub { $str =~ m/([abc]*[ab]*){2,12109}\d/; });
For a string with length 12 it takes 2.4 seconds to determine that there's no match, for 13 it's 8.3 seconds and for 14 it's 28 seconds.. And it grows exponentially.
In reply to Re: Regex infinite loop?
by moritz
in thread Regex infinite loop?
by Ninth Prince
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |