Is there a tool (or an algorithm) to convert a finite state machine into a regular expression?
(not the other way around, that would be easy).
You can use fsm2regex, an online tool that does the job.