I've discovered something that I can't explain in Python re module.
Compilation of (a*)*
or (a*|b)*
throws an error:
raise error, v # invalid expression sre_constants.error: nothing to repeat
I've tested this regexp in javascript and it seems to be ok.
Is it a bug?
Yes, it's a bug (or at least a misfeature). It's complaining that if a*
matches nothing, it doesn't know how to capture 0 or more "nothings".
A bug in Python.
http://bugs.python.org/issue2537
http://bugs.python.org/issue214033
Maybe a "bug" is not the correct word here. Different kind of interpretation...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With