TOPICS
Search

Regular Expression


Regular expressions define formal languages as sets of strings over a finite alphabet. Let sigma denote a selected alphabet. Then emptyset is a regular expression that denotes the empty set and epsilon is a regular expression that denotes the set containing the empty string as its only element.

If c in sigma, then c is a regular expression that denotes the set whose only element is string c. If p and q are regular expressions denoting sets L(p) and L(q), then

1. (p)|(q) is a regular expression denoting the set L(p) union L(q), where  union denotes the union.

2. (p)(q) is a regular expression denoting the set of all concatenations of m and n, where m in L(p) and n in L(q).

3. (p)^* is a regular expression denoting closure of L(p), that is, the set of zero or more concatenations of strings from L(p)

The languages defined by regular expressions are regular languages, also called regular sets. A language is regular iff it is defined by a right linear grammar.


See also

Formal Language, Grammar, Regular Language

This entry contributed by Alex Sakharov (author's link)

Explore with Wolfram|Alpha

References

Aho, A. V. and Ullman J. D. Theory of Parsing, Translation and Compiling, Vol. 1. Englewood Cliffs, NJ: Prentice Hall, 1972.Aho, A. V. and Ullman J. D. Theory of Parsing, Translation and Compiling, Vol. 2. Englewood Cliffs, NJ: Prentice Hall, 1972.

Referenced on Wolfram|Alpha

Regular Expression

Cite this as:

Weisstein, Eric W., with contributions by Alex Sakharov. "Regular Expression." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/RegularExpression.html

Subject classifications