3 ms·
> Having worked in an industry where the linear vs. exponential performance implications of regular expressions and PCREs was crucial (intrusion protection syst
by lloeki 5y ago
> Having worked in an industry where the linear vs. exponential performance implications of regular expressions and PCREs was crucial (intrusion protection systems)
same boat. that's why we use re2 in a way inspired by Go (which means losing a few features but the tradeoff is worth it):
> The regexp implementation provided by this package is guaranteed to run in time linear in the size of the input. (This is a property not guaranteed by most open source implementations of regular expressions.) For more information about this property, see
> https://swtch.com/~rsc/regexp/regexp1.html https://swtch.com/~rsc/regexp/regexp1.html
> or any book about automata theory.
https://pkg.go.dev/regexp https://pkg.go.dev/regexp
- colanderman 5y agoOCaml's regexps run in linear time also. They're based on Ville Laurikari's Tagged REs: https://laurikari.net/tre/ https://laurikari.net/tre/