Converting along regular expression to NFA

I have the following regular expression for the set of all strings such that each block of five consecutive symbols contains exactly two 0's (consider the alphabet to be {0, 1}):

(0+1+ϵ)4+(11100+ϵ)r(0011100r)*(00111+ϵ)

r=11+(110+ϵ)s(0110s)*(011+ϵ)

s=(0+10)*(1+ϵ)

How should I convert this into an NFA? Please explain the steps behind it as well!

• cs.stackexchange.com/q/137007/755
– D.W.
Mar 25, 2021 at 19:09
• It would be better for you to show more independence when doing your homework. Mar 28, 2021 at 14:07
• Where is your regular expression taken from? Mar 28, 2021 at 14:10
• @YuvalFilmus this regular was provided to me by my friend who is doing this assignment with me. And I have just asked a conceptual question regarding converting a regular expression to an NFA, which is something I cannot understand well. So, could you please answer my question? Mar 29, 2021 at 17:33
• cs.stackexchange.com/a/13606/755
– D.W.
Dec 7, 2022 at 19:14

However, for your problem, I'd consider constructing directly a DFA with $$10 = \begin{pmatrix}5\\2\end{pmatrix}$$ states corresponding to words of size 5 containing exactly two zeros, and a sink state (and maybe some other states for the begining of the reading).