Regex to State Machine Diagram

Regular expressions can be transformed into a state machine diagram. It is possible to map regex syntax to states and transitions.

The mapping defines the following regex syntax elements:

  • Optional expression: (expression)?
  • One or more occurrences: (expression)+
  • Zero or more occurrences: (expression)*
  • Or: (expressionA|expressionB)
Overview of regular expression syntax mapped to UML state machine blocks
Overview of regular expression syntax mapped to UML state machine blocks

New Comment

Comment