Does a regular expression exist for any number that contains no more than two 5s and no 6 twice in a row?
I attempted to solve the question separately:
The &quot;no more than two 5s&quot; bit can be represented by the regex $a^*(\epsilon+5)a^*(\epsilon+5)a^*$.
The &quot;no two 6s in a row&quot; bit can be represented by the regex $(a+6a)^*(6+a+\epsilon+6a)$.
Where $a\in\{1,2,3,4,7,8,9,0\}$.
Notice that we could potentially replace all the a*s in the first regex with the second regex, but this is problematic since it would allow double 6s. So I drew a FSM that uses this idea without violating the constraints. Hopefully, you could work out the regex and minimize the FSM if it can be minimized.
The language is regular since an FSM that defines it exists, hence its regular expression can be obtained.