3 ms·
> assuming your regexp engine is actually a regexp engine There is no guarantee that two regex that match the same corpus will compile to the same DFA or even
by true_religion 16y ago
> assuming your regexp engine is actually a regexp engine
There is no guarantee that two regex that match the same corpus will compile to the same DFA or even compile to a DFA at all. Do not confuse regex with a regular expression.
The answer isn't to turn against any of these variation of regex by deriding them as "compact" but instead test to see if this is a bottle neck, and try out a non-self documenting variation if it is.
- colanderman 16y agoYou are right, I should be more precise with my terminology. By "regexp" I meant "regular expression". Regardless, neither term implies implementation as a DFA, however regular expressions, and the subset of regexps which are equivalent to them, can and should be compiled to an optimized DFA.