RGPV PYQs
Q. What is a regular expression?
Solution. The language accepted by finite automata can be easily described by simple expressions called regular expressions.
Let,
Σ denotes the input set.
- Φ is a regular expression that denotes the empty set.
- ε is a regular expression and denotes the set {ε}, and it is a null string.
- For each ‘a’ in Σ, ‘a’ is a regular expression and denotes the set (a).
- 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 the occurrence of R an infinite number of times.
Some other examples of regular expressions are:
- R = a, i.e., all combinations of a.
- R = a+, i.e., all combinations of a without a null string.
- R = (a+b), i.e., strings contain any number of a and b