Q. What is Regular Expression ?
Ans. The language accepted by finite automata can be easily described by simple expressions called Regular Expressions.
Let,
Σ denote input set.
1. Φ is a regular expression which denotes the empty set.
2. ε is a regular expression and denotes the set {ε} and it is a null string.
3. For each ‘a’ in Σ ‘a’ is a regular expression and denotes the set (a).
4. If R1 and R2 are regular expressions denoting the Languages L1 and L2 respectively, then
- R1+R2 is equivalent to LI ∪ L2 i.e. union.
- R1R2 is equivalent to L1 ∩ L2 i.e. concatenation
- R* is equivalent to L1* i.e. closure.
The R* is known as kleen closure or closure which indicates occurrence of R for infinite number of times.
Some other examples of regular expressions:
- R = a*, ie. all combinations of a.
- R = a+, ie. all combinations of a without null string.
- R = (a+b)*, ie. strings containg any number of a and b