This is 2nd Part of Regular expression in theory of computation solved examples. You can also read Regular expression in theory of computation solved examples Part – 1.
5. Construct a regular expression for the set of all strings ovetr (A, . . . ., Z, a, . . . . , z) that contains 3 X’s.
Solution:
We have the input alphabets ∑ = {A, . . . ., Z, a, . . . . , z}
Here, the resultant regular expression will denote the set of all string over the given ∑ which contains occurrence of x’s three times.
In the first step, let us assume that
<letter> = {A, . . . , Z, a, . . . . . z}
Thus, the regular expression for the set of all strings over the given ∑ can be written as-
<letter>*
Thus, the required resultant regular expression which denotes the set of all strings that contains 3 x’s over the given ∑ can be written as-
<letter>* x <letter>* x <letter>* x <letter>*









It can only handle consecutive a’s! If we have a string like
aabcbca or abcaba
it can not handle them!