Last Updated on Sep 30, 2016
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.
2. Construct a regular expression for all strings which contains no runs of a’s of length greater than two, over input alphabet {a, b, c}.
Solution:
We have the input alphabets ∑ = {a, b, c}.
Here, the resultant regular expression will denote the set of all strings in which no runs of a’s of length greater than two.
Here, a regular expression that contain no ‘a’, one ‘a’, or one ‘aa’ can be written as-
(b + c)* (λ + a + aa) (b + c)*
Now, as per the problem demand, we have to repeat it. For this, we need to be sure to have atleast one non-a between repetitions.
Thus, the regular expression which fulfill the requirement of the given problem can be written as-
(b + c)* (λ + a + aa) (b + c)* ((b + c)* (λ + a + aa) (b + c)*)









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