User:Repku/sandbox

Nick Ashford died in hospital on August 22, 2011 at the age of 70. )

FROM regular expressions ARTICLE:

Syntax
A regexp pattern matches a target string. The pattern is composed of a sequence of atoms. An atom is a single point within the regexp pattern which it tries to match to the target string. The simplest atom is a literal, but grouping parts of the pattern to match an atom will require using  as metacharacters. Metacharacters help form atoms, quantifiers telling how many atoms (and whether it is a greedy quantifier or not), a logical OR character (which offers a set of alternatives, and a logical NOT character, which negates an atom's existence), and back references to refer to previous atoms of a completing pattern of atoms. A match is made, not when all the atoms of the string are matched, but rather when all the pattern atoms in the regular expression have matched. The idea is to make a small pattern of characters stand for a large number of possible strings, rather than compiling a large list of all the literal possibilities.

Depending on the regexp processor there are about fourteen metacharacters, characters that may or may not have their literal character meaning, depending on context, or whether they are "escaped", i.e. preceded by an escape sequence, in this case, the backslash. Modern and POSIX extended regular expressions use metacharacters more often than their literal meaning, so to avoid "backslash-osis" it makes sense to have a metacharacter escape to a literal mode; but starting out, it makes more sense to have the four bracketing metacharacters  and   be primarily literal, and "escape" this usual meaning to become metacharacters. Common standards implement both. The usual metacharacters are  and. The usual characters that become metacharacters when escaped are  and.