5 ms·
In common usage, "regex" means patterns accepted by regex engines like PCRE. Police the formal term "regular expression" if you like, but ordinary usage does no
by ghusbands 2mo ago
In common usage, "regex" means patterns accepted by regex engines like PCRE. Police the formal term "regular expression" if you like, but ordinary usage does not honour that distinction.
Also, it's not guaranteed that an engine implementing regular expressions will have O(n) time complexity - a backtracking engine can still have much worse performance on formal regular expressions.
- Ferret7446 1mo agoThere is no backtracking in actual regular expressions. Your misunderstanding is the technicality that the parent was taking about.
- ghusbands 1mo agoRegular expressions aren't an algorithm. DFA/NFA-based matching and backtracking are both valid implementation strategies, with different performance characteristics. Backtracking is arguably the most intuitive direct implementation. You and the other poster are confusing the mathematical definition with algorithms used to perform matching.