For a complete description look here.
To get some practice, click here.
Construct | Description |
---|---|
. | matches any character (except the new line) |
\n | matches newline |
\t | matches tab |
\r | matches carriage return |
\f | matches formfeed |
\d | matches a digit (same as [0-9]) |
\D | matches a non-digit |
\s | matches a whitespace character |
\S | matches a non-whitespace character |
\w | matches a word character (same as [0-9a-z_A-Z]) |
\W | matches a non-word character |
\b | matches a word boundary |
\B | matches a non-(word boundary) |
^ | matches the beginning of string |
$ | matches the end of string |
expr1|expr2 | matches expr1 or expr2 |
expr* | matches any number of expr |
expr+ | matches 1 or more occurrences of expr |
expr? | matches 0 or 1 occurrence of expr |
expr{n,m} | matches at least n and at most m occurrences of expr |
expr{n,} | matches at least n occurrences of expr |
expr{n} | matches exactly n occurrences of expr |
[class] | matches any of the characters in class |
[^class] | matches characters not in class |
(expr) | groups expressions |
\\ | matches `\' |
\. | matches `.' |
Some examples:
Last modified: 2004-11-03