Professional Documents
Culture Documents
Parentheses ( )
= { 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 }
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+