FSM2Regex

Convert your FSMs to regexes
and your regexes to FSMs!

① Create automaton

Enter a FSM below and the application will convert and show the equivalent regular expression. Alternately, enter a regular expression and the application will convert and show the equivalent FSM.

Input automaton

Enter a FSM into the input field below or click Generate random DFA/NFA/eNFA to have the app generate a simple FSM randomly for you. The page will detect the chanage, show the equivalent regex, and display the FSM's transition graph.

A valid FSM definition contains a list of states, symbols and transitions, the initial state and the accepting states. States and symbols are alphanumeric character strings and can not overlap. Transitions have the format: stateA:symbol>stateB,stateC. The $ character is used to represent the empty string symbol (epsilon) but should not be listed in the alphabet. Generate a FSM to see a valid example.

Input regex

Enter a regular expression into the input field below or click Generate random regex to have the app generate a simple regex randomly for you. The page will detect the chanage, show the equivalent FSM, and display its transition graph.

A valid regex consists of alphanumeric characters representing the set of input symbols (e.g. a, B, 9), the $ character representing the empty string, the choice operator +, the Kleene operator *, and parentheses ( and ). An example of a valid regex is: (a+B)*(c9+$)+$.


② Transition graph

The FSM being converted is displayed in the form of a transition graph.

③ What's next?

This is just the beginning! If you like learning about and playing with FSMs and regexes, check out these other Web apps:

④ Feedback

Love the application, hate it, found a bug, or have a feature idea? I'd love to hear about it! Please send your feedback via the noam project issues page on GitHub.