# Finding strings that are matched by a given regular expression

I'm trying to be ahead of the game by studying some Theory of Computation concepts before class starts at the end of this month. There's this question I came across that I don't understand below.

Let L be the language defined by the regular expression:
(c U ab U b)*bb(c U ab)

(U = union)

A.  Write 10 distinct strings that belong to L.
If such strings don't exist, explain why.

B.  Write 10 distinct strings over alphabet {a,b,c} that don't belong to L.
If such strings don't exist, explain why.


I'm totally lost, I have the answer but I just don't get how to go about it.

The only answers that I've came up with, that belong to L, was:

bbc, bbab


Which's only 2 correct out of the 10 listed in the answer key. I just can't see how to come about the rest of them.

Thanks for taking the time to read.

• Do you understand regular expression notation? Why don't you use the part before bb to generate more strings? Jan 5 '17 at 14:01
• @adrianN Thanks for your response. Here are some of the answers I came up with, since it says distinct strings. Tell me if they could be right: 3. cabb 4. cccccab 5. cababca 6. abcbbb 7. ccbabb 8. abbcb Jan 5 '17 at 14:08

Let's break down the regular expression $(c \cup ab \cup b)^*bb(c \cup ab)$. It has three parts $(c \cup ab \cup b)^*$, $bb$, and $(c \cup ab)$. The first part means "zero or more repetitions of $(c \cup ab \cup b)$", the second part matches two $b$, and the third part matches $c$ or $ab$.
• Thanks :). Does this mean I can make any combination of strings within (c U ab U b)*, right? Since the star represents strings that are >= 0? Jan 5 '17 at 14:32