Examples of Finite Regular Expressions

Finite Regular expressions are used to represent the finite regular languages. As we know, finite regular languages have a finite number of strings. So, the length of finite regular expressions is always limited.

Examples of Finite Regular Expressions

Following are the various examples of finite regular expressions

Example 01

Write the regular expression for the language which has no string.

Solution:

Language for the given example is given below

L = { } //empty string

Regular expression for the above language is given below

L(R) = Φ

Example 02

Write the regular expression for the language with a string with zero length.

Solution

Language for the given example is given below

L = { ε } //single string

Regular expression for the above language is given below

L(R) = ε

Example 03

Write the regular expression for the language with a string with a single length over ∑ = {a, b}.

Solution

Language for the given example is given below

L = { a,b } //string with single length

A regular expression for the above language is given below

L(R) = (a+b)

Example 04

Write the regular expression for the language with a string with the length of two over ∑ = {a, b}.

Solution

Language for the given example is given below

L =  (a,b).(a,b) = { aa,ab,ba,bb } //string with length of two

A regular expression for the above language is given below

L(R) = (aa+ab+ba+bb)

Example 05

Write the regular expression for the language with a string of three over ∑ = {a, b}.

Solution

Language for the given example is given below

L = (a,b).(a,b). (a,b) = { aaa,abb,aab,baa……..,bbb } //string with length of three

Regular expression for the above language is given below

L(R) = (aaa + abb + aab + baa+……..+ bbb)

Example 06

Write the regular expression for the language with strings with an at-most length of 2 over ∑ = {a, b}.

Solution

Language for the given example is given below

L = (ε,a,b).( ε,a,b) = { ε, a ,b, aa,ba……..,bb } // strings with at-most length of 2

Regular expression for the above language is given below

L(R) = (ε+a+b).( ε+a+b)

Example 07

Write the regular expression for the language with strings “Not More than two a’s and one b” over ∑ = {a, b}.

Solution

Language for the given example is given below

L = { ε, a ,b, aa,aba, aab…….. } // strings with Not More than two a’s and one b

Regular expression for the above language is given below

L(R) = { ε + a + b + aa +aba + aab+…….. }