Regex icon indicating copy to clipboard operation
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:

  1. Handle escape symbols and convert the regular expression into reverse Polish notation.
  2. Convert the expression into an NFA.
  3. Convert the expression into a DFA.
  4. 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