How can I convert a regular expression such as:
((e|£|\$)([1-9][0-9]*|0)(,|\$|\.){1}([0-9][0-9]))|(([1-9][0-9]*|0),[0-9][0-9](EUR))|([1-9][0-9]*|0)\$[0-9]{2}
to a finite automata like this:
How can I convert a regular expression such as:
((e|£|\$)([1-9][0-9]*|0)(,|\$|\.){1}([0-9][0-9]))|(([1-9][0-9]*|0),[0-9][0-9](EUR))|([1-9][0-9]*|0)\$[0-9]{2}
to a finite automata like this:
Try this online tool https://regexper.com/ which will automatically generate diagram
I won't go through the details but the process might look like this:
Rewrite your regex as a fully-parenthesized formal regular expression. If your regex has no equivalent fully parenthesized formal regular expression, stop; there is no finite automaton.
Use the standard constructive algorithm for proving finite automata are as powerful as (formal) regular expressions to construct a nondeterministic finite automaton which accepts the language described by the (formal) regular expression obtained in step 1.
Optional: determinize the nondeterministic finite automaton obtained in step 2 using e.g. the subset/powerset constructive algorithm used to show deterministic finite automata are as powerful as nondeterministic ones.
Optional: minimize the deterministic finite automaton obtained in step 3 using some standard DFA minimization algorithm.