Examples of Infinite Regular Expressions
Infinite Regular expressions are used to represent the infinite regular languages. So, the length of infinite regular expressions is always Unlimited.
Example 01
Write the regular expression for the language which accepting all the strings which having all combinations of a’s over ∑ = {a}.
Solution
Language for given example is given below
L = { ε, a, aa, aaa, aaaa, aaaaa, ……….. }
Regular expression for above language is given below
L(R) = a*
Example 02
Write the regular expression for the language which accepting all the strings which having all combinations of a’s except the null string over ∑ = {a}.
Solution
Language for given example is given below
L = {a, aa, aaa, aaaa, aaaaa, ……….. }
Regular expression for above language is given below
L(R) = a+
Example 03
Write the regular expression for the language which accepting all the strings, which having any number of a’s and b’s over ∑ = {a, b}.
Solution
Language for given example is given below
L = {a, b, ab, ba, aab, aba, aaba ……….. }
Regular expression for above language is given below
L(R) = (a+b)*
Example 04
Write the regular expression for the language which accepting all the strings, having only one “b” and any numbers of “a” over ∑ = {a, b}.
Solution
Language for given example is given below
L = {b, ab, aba, abaa, abaaaa, aaaaabaaaaaaa……….. } // all strings having only one “b”
Regular expression for above language is given below
L(R) = a*ba*
Example 05
Write the regular expression for the language which accepting all the strings, which are starting with 1 and ending with 0, over ∑ = {0, 1}.
Solution
Language for given example is given below
L = {10, 100, 11010, 1110, 1111000, ……….. } // starting with 1 and ending with 0
Regular expression for above language is given below
L(R) = 1(0+1)*0
Example 06
Write the regular expression for the language which accepting all the strings having even length, over ∑ = {0}.
Solution
Language for given example is given below
L = { ε, 00, 0000, 000000, 00000000, ……….. }
Regular expression for above language is given below
L(R) = (00)*