4 ms·
Could a regex library parse a regular expression and decide reasonably quickly which engine to use?
by dkarl 16y ago
Could a regex library parse a regular expression and decide reasonably quickly which engine to use?
- kingkilr 16y agoProbably, but python-core has no interest in maintaining multiple regular expression implementations: http://mail.python.org/pipermail/python-dev/2010-July/101606.html http://mail.python.org/pipermail/python-dev/2010-July/101606... (this thread starts talking about regex, which is a backwards compatible enhancement to re, but also covers re2)
- axiak 16y agoYes. That's precisely what pyre2 is doing. It's trying re2, and if it fails because it doesn't support the features, it tries the python re. Since compilation happens rarely, this is fast.