Theory of Automata

Examples of Finite Regular Expressions



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

Examples of Finite Regular Expressions

Example 01

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

Solution:

Language for given example is given below

L = { } //empty string

Regular expression for above language is given below

L(R) = Φ

Example 02

Write the regular expression for the language which has string with zero length.



Solution

Language for given example is given below

L = { ε } //single string

Regular expression for above language is given below

L(R) = ε

Example 03

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

Solution

Language for given example is given below

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

Regular expression for above language is given below

L(R) = (a+b)

Example 04

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



Solution

Language for given example is given below

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

Regular expression for above language is given below

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

Example 05

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

Solution

Language for 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 above language is given below

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

Example 06

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

Solution

Language for 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 above language is given below

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

Example 07

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



Solution

Language for 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 above language is given below

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

Help Other’s By Sharing…

Contact Us

Burewala, Vehari, Punjab, Pakistan

cstaleem1@gmail.com

Website: CStaleem.com

Pin It on Pinterest