正则表达式和自动机具有等价性 EQUIVALENCE WITH FINITE AUTOMATA
Regular expressions and finite automata are equivalent in their descriptive
power. This fact is surprising because finite automata and regular expressions
superficially appear to be rather different. However, any regular expression can
be converted into a finite automaton that recognizes the language it describes,
and vice versa. Recall that a regular language is one that is recognized by some
finite automaton
定理
A language is regular if and only if some regular expression describes it.
正则表达式与文法
grammars are a more powerful notation than regular expressions. Every construct that can be described by a regular expression can be described by a grammar, but not vice-versa. Alternatively, every regular language is a context-free language, but not vice-versa.
java regex 底层实现也是 state machine,即自动机