Regular expressions#
Regular expressions originate from the theory of formal languages in mathematics or computer science. They are closely related to finite state machines and are a way to define a set of words which match certain criteria. The most common application of a regular expression, or regex for short, is parsing of textual data and recognizing or finding textual patterns.
The regular expression itself is given in one of several competing regular expression languages or regular expression flavours. The crucial point is to understand the syntax and grammar of the regular expression language. Unfortunately not all of these languages are compatible. A de facto standard is defined by POSIX extended regular expressions (ERE). Further, many programming languages define their own regex flavour. A very wide spread example is the perl (compatible) regular expression language (PCRE). The following, however, sticks to POSIX.