by bawolff · 6y ago · 0 comments
(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: actually, even with recursive construct (at least in PCRE) I think its still impossible.
Multiple different grammars can define the same language. There are context free grammars for regular languages.
A -> bAb where b is a terminal, ok.
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.