I am trying to construct finite automata for this regular expression: Every block consisting of 5 characters need to contain at least two zeros. The regular expression would look sth like this:
(00(1|0)(1|0)(1|0)(1|0) + 0(1|0)0(1|0)(1|0) + 0(1|0)(1|0)0(1|0) + 0(1|0)(1|0)(1|0)0 + (1|0)00(1|0)(1|0) + (1|0)0(1|0)0(1|0) + (1|0)0(1|0)(1|0)0 + (1|0)(1|0)00(1|0) + (1|0)(1|0)0(1|0)0 + (1|0)(1|0)(1|0)00 )+
The problem is this is a long regular expression and i am not sure if am doing it the correct way. I have no idea how we can make it shorter. I would be grateful for telling me the best way to do it.
Hint. It is easier to first consider the complement of your language, which is the set of words containing at least one factor of length $5$ containing at most one $0$. Setting $A = \{0,1\}$ and $R = \{u \in \{0,1\}^5 \mid |u|_0 \leqslant 1\}$, the complement of your language is thus $A^*RA^*$ and thus your language is $L = A^* - A^*RA^*$. You now have to find the minimal DFA of $L$ and then convert this DFA to a regular expression.
Note that the words of length $< 5$ are all in $L$ but do not match your regular expression.