4 ms·
If you are doing something heavy on regular expression, then you are much better off with re2 from google. https://pypi.org/project/re2/ https://pypi.org/proje
by MichaelMoser123 5y ago
If you are doing something heavy on regular expression, then you are much better off with re2 from google.
https://pypi.org/project/re2/ https://pypi.org/project/re2/
https://swtch.com/~rsc/regexp/regexp1.html https://swtch.com/~rsc/regexp/regexp1.html
Also re is running in python, whereas re2 is written in C (with python language bindings)
I wonder, why python didn't ditch the built-in re package in favor of re2... That might be due to some compatibility issues, but i don't know anything specific.
- deleted 5y ago[deleted]
- metadat 5y agoAre you able to qualify: Better off in what way? The built-in re package has always been sufficient for me and I dream in regex.
- Loranubi 5y agore2 is using state machines to evaluate everything in linear time. Backtracking re implementations have some very slow edge cases.
- Loranubi 5y agoBecause re2 doesn't support everything POSIX regex support.
- jwilk 5y agoWhy does it matter? Python's re doesn't support all POSIX ERE constructs either.