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.
6. Construct a regular expression for all strings over {0, 1} of length 6 or less.
Solution:
We have the input alphabets ∑ = {0, 1}
Here, the resultant regular expression will denote the set of all strings over the given input alphabets ∑ of length 6 or less. The set of all strings of length zero or one can be given by the following regular expression-
(λ + (0 + 1))
Thus, the resultant regular expression which denote the set of all strings over the given ∑ of length 6 or less can be given by-
(λ + (0 + 1)) (λ + (0 + 1)) (λ + (0 + 1)) (λ + (0 + 1)) (λ + (0 + 1)) (λ + (0 + 1))
As per the mathematically representation we can write it as-
(λ + (0 + 1))6









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