How do I generate regular expression from this deterministic finite state automaton?

217 Views Asked by At

I want to create a regular expression from the following deterministic finite automaton:

"abb" substring search

abb substring search

How do I generate regexp from above dfa and what are the steps for doing so?

Deterministic finite automaton generated from snippet:

{ w in {a,b}* | w contains the substring abb }
1

There are 1 best solutions below

2
On BEST ANSWER

There are several methods for finding a regular expressions for the language accepted by a finite automaton. In this case, though, you don't need them. If you have $\{w\in\{a,b\}^*\mid w\text{ contains }abb\}$, then any string in that language is just $$ <something>abb<something> $$ and the regular expression for these strings is obviously $$ (a\cup b)^*abb(a\cup b)^* $$ [or however you're used to writing regexps: $(a\mid b)^*abb(a\mid b)^*$, or $(a+ b)^*abb(a+ b)^*$].