Perl Regular Expressions

(modified from this page)

The following is paraphrased from the Perl reference guide, a postscript quick reference to Perl syntax.

Each character matches itself, unless it is one of the special characters: +?.*()[]{}|\

. matches an arbitrary character, but not a newline
(...) groups a series of pattern elements to a single element
The parenthesis group units together. For an example, see the next entry.

+ matches the preceding pattern element one or more times

? matches the preceding pattern element zero or one times
* matches the preceding pattern element zero or more times
{n} means exactly n times {n,} means at least n times {n,m} denotes the minum n and maximum m match count. [...] denotes a class of characters to match (...|...|...) matches on of the alternatives The above reserved punctuation can be searched for by ("escaped from their regular meanings") by using a preceding \ \w matches alphanumeric, including "_".
\W matches non-alphanumeric (i.e., punctuation)

\b matches word boundaries
\B matches non-boundaries

\s matches whitespace
\S matches non-whitespace

\d matches numeric
\D matches non-numeric

\n, \r, \f, \t mean "newline", "carriage-return", "form-feed", and "tab"

\w, \s, \d may be used within character classes, \b denotes backspace in this context.