Ecture: Regular Expressions
Ecture: Regular Expressions
Chapter 4
Regular Expressions
IMPORTANT TERMS
Regular Expressions
Regular Languages
Finite Representations
RECURSIVE DEFINITION OF REGULAR
EXPRESSIONS
(rl)
r1r2
r1 + r 2
r l*
S+ = S1 + S2 + · · · (Positive Closure)
EXAMPLE
Suppose that we wished to describe the language
L over the alphabet ∑ = {a,b} where L = {a ab
abb abbb abbbb ... }
R.E= ab*
(ab)* = ^ or ab or abab or ababab ...
XX* = X+
L = language(a*ba*ba*)
EXAMPLE:
∑ = {a, b}
language L of all words with at least two b’s
E = [aa + bb + (ab+ba)(aa+bb)*(ab+ba)]*
Type 1 = aa
Type 2 = bb
Lr {a b 2n 2m
b : n, m 0}