New things for regular expressions in PostgreSQL (pg_tre and pg_re2)
2 points by fanf
2 points by fanf
Why can't I use
(?<=…? It's limitation of re2 library. To make it fast certain things have been removed.
Technically it’s not to make it fast, re2 is not necessarily that fast. It’s to make it execute in linear time: historically we only knew how to implement lookaround assertions using backtracking (which then opens you up to catastrophic backtracking issues, classic ReDOS). re2 is built on finite automata to avoid this (also rust’s regex and go’s regexp).
However recent papers from EPFL have demonstrated that it’s possible to support linear-time captureless lookbehinds without backtracking and in linear time, and in at least some dialects unrestricted lookarounds.