Regular Expressions
PK EDUCATION
" Regular expressions are used for representing certain sets of
strings in an algebraic fashion.
A regular expression is a string that represents a regular language
ECOng
using
PK
concatenationP Kand Kleene star operations.
Educationa
atb ab
jitute
Regular Expressions
(0) Union: a+b (or) a |b
"b'
ne expression 'a' or the expression
"Matches either the
" Also known as OR operator. ycational Institute
(i) Concatentia..
"Matches the expression 'a followed by the expressionpional
"b'. Institu
"Also known as AND operator.
Regular Expressions
(ii) Kleene Star: a*
Matches zero or more occurrences of the expression 'a'.
"(iv)a* Klesducationtvea
={[, a, aa, Institute
rrenucational
Plus: at or aa*
" Matches one or more of the expression 'a'.n aInstitut
l
" at ={a, aa, aaa,...)
ORegular expression to NEA (Thompson's construction)
3. For regular expression slt or (st)
start
For Example: (ab) or (a + b)
ORegular expression to NFA (Thompson's construction)
4. For regular expression st
start,
N(S) N)
For Example: ab
ORegular expression to NFA (Thompson's construction)
s. For regular expression s
start
For Example : a