I'm aware regular expressions, as a concept, represent a single Regular Language, which can be processed via a DFA/NFA with O(n)
~O(2^m)
complexity, being n
the size of the string and m
the size of the regex. Most stack-overflow discussions about the subject quote this awesome article that proves it.
However, regex implemented in modern languages deal with more than regular languages. For instance, it's possible to recognize palindromes with regex, a context-free grammar problem that, when solved via a push-down automata(PDA), is known to have a O(n³) complexity.
I would like to know were exactly in the Extended Chomsky Hierarchy modern (perl or python re
, for example) regex implementations fit, or, at least, their worst possible complexity.