# What is the regular expression of this language? [duplicate]

$\Sigma = \{0, 1\}$

$L = \{x$| $x \in \Sigma^*$ $\&$ $\#_0(x) = 3$ $or$ $\#_1(x) = 3 \}$

What is the regular expression of this language?

At first I thought $r = (0+1)^*0(0+1)^*0(0+1)^*0$ $or$  $r = (0+1)^*1(0+1)^*1(0+1)^*1$

And what is it's corresponding NFA/DFA?

I've been puzzled by this language and if it's regular for a while now.

• @D.W. In my humble opinion you take it too serious with marking duplicate questions. Marcus is struggling to find a solution for this paritcular problem and you can assume that he has already read explanations. Linking a thread which explains the general problem is only little better than posting an IBAN and say: buy that book and read it. This platform is called stackexchange and not stackreference. If the exact same question (as the UI string says) has already been answered, then it is totally okay to close it. – alsdkjasdlkja Jun 24 '16 at 17:39
• Thanks for the feedback, @nxrd. I guess different people can reasonably hold different opinions on where to draw the line. My thought process: We expect people to show us in the question what they've tried and what approaches they've considered (as explained here). If he has already read those resources and tried applying them and wasn't able to, I encourage him to edit the question to show what happened when he tried applying those techniques and where specifically he got stuck, and it can be considered for re-opening. – D.W. Jun 24 '16 at 17:49
• As far as our mission, for many of us generating an archive of high-quality questions and answers that will be useful not only to the asker but also to others in the future is at least as important or more important than acting as a help desk for the world. See also blog.codinghorror.com/rubber-duck-problem-solving and blog.stackoverflow.com/2011/06/optimizing-for-pearls-not-sand and meta.stackexchange.com/q/217115/160917 for more on general philosophy. – D.W. Jun 24 '16 at 17:50

• Ah you're right! I was too fixated on the $(0+1)^*$ and not making them $(0)^*$ and $(1)^*$ respectively. – marcusvb Jun 24 '16 at 13:03