Writing Regular Expression
Writing Regular Expression
2
Now consider another language L, consisting
of all possible strings, defined over
Σ = {a, b}. This language can also be
expressed by the regular expression
(a + b)*.
Now consider another language L, of strings
having exactly double a, defined over
Σ = {a, b}, then it’s regular expression may
be
b*aab*
3
Now consider another language L, of even
length, defined over Σ = {a, b}, then it’s
regular expression may be
((a+b)(a+b))*
Now consider another language L, of odd
length, defined over Σ = {a, b}, then it’s
regular expression may be
(a+b)((a+b)(a+b))* or
((a+b)(a+b))*(a+b)
4
Remark
5
Example:
Consider the language, defined over
Σ={a , b} of words having at least one a,
may be expressed by a regular expression
(a+b)*a(a+b)*.
Consider the language, defined over
Σ = {a, b} of words having at least one a
and one b, may be expressed by a regular
expression
(a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. 6
Consider the language, defined over
Σ={a, b}, of words starting with double a
and ending in double b then its regular
expression may be aa(a+b)*bb
Consider the language, defined over
Σ={a, b} of words starting with a and
ending in b OR starting with b and
ending in a, then its regular expression
may be a(a+b)*b+b(a+b)*a
7
TASK
8
TASK
9
SummingUP Lecture 3