You are on page 1of 18

Wasim Ahmad Khan

Symbols for Regular Expressions



The letter of alphabet

Symbol of Null String

Parentheses ( )

The Star Operator *

The Plus Sign +


Rule 1
I. Any letter from
II.
III.
Any letter from = { a , b}

All the string starting with a


and having length 1
R.E.=a
String having length less than 1

= { a , b}
R.E.=
All the Strings whose length is neither even
nor odd
= { a , b}
R.E.=
Rule 2
If r1 and r2 are two valid regular
expressions then so are
r1 + r2
r1 r2
r1*
( r1)
Note: + is used for choice in Regular Expressions
1. Any string with the = { p , q , r , s }

Note The word ANY STRING means all the


string which we can make from the given
language.
The easiest way to make a regular expression is
to put the plus sign + between all the
characters and encircle them with parentheses
() and put * after that.
R.E. = ( p + q + r + s ) *
It means to make the regular expression of the any of
the specific length
For minimum
minimum exact length up to infinity
e.g. R.E of Minimum length 3 over { a , b }
R . E = ( a + b )( a + b )( a + b )( a + b )*
For maximum
means up to a certain length, can be null also.
e.g. R.E of Maximum length 3 over { a , b }
R . E = ( a + b + )( a + b + )( a + b + )
All the string having minimum length 3 and
maximum length 7

R.E = ( a + b )( a + b )( a + b )( a + b + )
(a+b+)(a+b+)(a+b+)
All the strings of aa and bb over
={a,b}

R. E. = ( aa + bb )*
All the strings over ppp and rr
over = { p , r }

R. E. = ( ppp + rr )*
All the string ending with r
over = { a , b , r }

R. E. = ( a + b + r )* r
All the string starting and ending with
different letters over = { p , q , r }

R. E. = p ( p + q + r )*( q + r ) +
q ( p + q + r )*( p + r ) +
r ( p + q + r )*( p + q )
All strings starting and ending
with a over ={ a , b}

R. E. = a + a ( a + b )* a
All the strings starting and ending with
same letter over ={ l , m , n , o}

R. E. = ^ + l + m + n + o +
l ( l + m + n + o)* l +
m ( l + m + n + o)* m +
n ( l + m + n + o)* n +
o ( l + m + n + o)* o
All the strings having t over
={ s , t , u , v}

R. E. = ( s + t + u + v)* t ( s + t + u +
v)*
All strings starting with _ or L
over ={ _ , L , D }

R. E. = ( _ + L )( _ + L + D )*
All strings containing decimal point.

R. E. = D*D.D* + D*.DD*
or
D+.D+

You might also like