Regex
Regex copied to clipboard
正则表达式解析引擎
I have implemented regular expression operations for concatenation, alternation, and closure using parentheses and escape symbols: . | * ( ) . The main method is in TEST.java, and the steps are as follows:
- Handle escape symbols and convert the regular expression into reverse Polish notation.
- Convert the expression into an NFA.
- Convert the expression into a DFA.
- Simulate the DFA operation.
The next step is to implement extended regular expressions.
Testing:
RE :(d(a|b)*c)|a
dc
true
dac
true
dbbbc
true
a
true
RE :\.*()
.*()
true
RE :(a|b)(c|e)
ac
true
be
true
ae
true