by eru · 6y ago · 0 comments
There's a few interesting additions you can make to POSIX style regex that preserve the linear runtime: eg complement, difference or intersection of regular expression, see eg https://docs.rs/regex/1.3.9/regex/#syntax
And there's lots of other backtracking-mandatory features that you see in some non PCRE flavours.
(Match all lines that are palidromes in posix BRE syntax) cannot be done with a finite state machine.
I don't think a state machine can do it as it needs to remember the captured part, but not sure. Fairly sure capture groups can't be FSMs.
edit: I was wrong. back references are in posix. https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1...
so I guess not even all posix RE can be converted to finite state machines.