# Regular expression for set of all strings containing no 3 consecutive 0s?

$$1^*01^*01^*+1^*(0+00+\in)1^*$$

If I had to rephrase my question, it would be how to approach regular expression problems? Is it all about practice?

How do I understand what the regular expression is doing just like in this case here.

I think I can create DFA for this, but not sure if that would help me to create regular expression(I know there are posts to convert dfa to regular expression but I don't want that hassle).

• $101010101010$ isn't accepted by this regex, for example. But it would be in the language since it doesn't contain $3$ consecutive $0$s. Nov 10, 2021 at 9:33

$$(00 +0 + \epsilon)(1(00 + 0 + \epsilon))^*$$
• stackoverflow.com/questions/26365602/… I use this dfa and I got regular expression $(1+01+001)^* + (1+01+001)^*0+(1+01+001)^*0$. I used arden's theorem. Is this also correct? Nov 10, 2021 at 11:10
• @custep It is not since your expression does not accept the string $00$. Nov 10, 2021 at 11:51
• I got it correct. It was typing mistake the last one $(1+01+001)^*00$ Thanks a lot for correction. Nov 10, 2021 at 12:24