The following Python code is incredibly slow:
import re
re.match( '([a]+)+c', 'a' * 30 + 'b' )
and it gets worse if you replace 30 with a larger constant.
I suspect that the parsing ambiguity due to the consecutive +
is the culprit, but I'm not very expert in regexp parsing and matching. Is this a bug of the Python regexp engine, or any reasonable implementation will do the same?
I'm not a Perl expert, but the following returns quite fast
perl -e '$s="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"; print "ok\n" if $s =~ m/([a]+)+c/;'
and increasing the number of 'a' does not alter substantially the execution speed.