A | B |
"Regular Expression" (abbreviated) | regex |
metacharacter | character not taken literally |
literal | normal text character |
anchor | metacharacter matching a position |
[... ] character class | matches any one of several characters |
dash (-) between 2 chars in character class | indicates range of chars |
[^...] negated character class | matches any char not listed |
dot (.) | matches any character |
or, bar (|) | separates alternative subexpressions |
parentheses (...) | create subexpression (grouping) |
quantifiers (?, +, *) | indicate number of occurences of previous item |
...? (question mark) | zero or one occurences of previous item |
...* (star, asterisk) | zero or more occurences of previous item |
...+ (plus) | at least one occurence of previous item |
described by a regex | a set of strings satisfying certain constraints |
^... | begin of line (anchor) |
...$ | end of line (anchor) |
\w (lower case) | part-of-word char [a-zA-Z0-9_] |
\W (capital) | non-word char [^w] |
\d (lower case) | digit [0-9] |
\D (capital) | non digit [^0-9] |
\s (lower case) | whitespace character [ \f\n\r\t\v] |
\S (capital) | non-whitespace character [^\s] |
escaping | neutralizing a metacharacter (reducing it to text) |
\char (if combination is not metadescriptive) | escaped char |
\t | tab character |
\r | return character |
\n | newline character |
...{min,max} | repeat previous at least min times, but not more than max times |
...{min,} (comma!) | repeat previous item at least min times |
...{num} (no comma) | repeat previous item num times |
grouping | putting part of a regex between parentheses (creates a subexpression) |
\ followed by a digit | back reference to the digith subexpression (between parentheses) |