In automata, a regular expression is a sequence of patterns that defines a string. Regular expressions are used to match character combinations in a string and are used to denote regular languages. A regular expression can be defined as a language or string accepted by a finite automata. Regular expressions can be recursively defined as follows:
- ε is a Regular Expression indicating the language containing an empty string.
- φ is a Regular Expression denoting an empty language.
- x is a Regular Expression where L = {x}.
- If X is a Regular Expression denoting the language L(X) and Y is a Regular Expression denoting the language L(Y), then X + Y is a Regular Expression corresponding to the language L(X) ∪ L(Y).
- X . Y is a Regular Expression corresponding to the language L(X) . L(Y).
- R* is a Regular Expression corresponding to the language.
Regular expressions are used to generate regular languages, which are the most restricted types of languages and are accepted by finite automata.