Regular expression

Most formalisms provide the following operations to construct regular expressions.

These constructions can be combined to form arbitrarily complex expressions, much like one can construct arithmetical expressions from numbers and the operations +, −, ×, and ÷.

Given regular expressions R and S, the following operations over them are defined to produce regular expressions:

As seen in many of the examples above, there is more than one way to construct a regular expression to achieve the same results.

There are at least three different algorithms that decide whether and how a given regex matches a string.

Because regexes can be difficult to both explain and understand without examples, interactive websites for testing regexes are a useful resource for learning regexes by experimentation. This section provides a basic description of some of the properties of regexes by way of illustration.

Also worth noting is that these regexes are all Perl-like syntax. Standard POSIX regular expressions are different.