Symbol |
Function |
. |
Matches any single character except a
newline character. Does not match repeated newlines. |
[xyz] |
A character set. Matches any characters
between brackets. |
[^xyz] |
A negative character set. Matches any
characters NOT between brackets including newline characters.
|
[a-z] |
Specifies a range of characters. |
[^a-z] |
Negates the character class, causing it to match a single character not
listed in the character class. |
\ |
Indicates the next character has a special meaning. "n" on it¡¯s own
matches the character "n". "\n" matches a linefeed or newline character.
See examples below (\d, \f, \n etc).
|
^ |
Matches/anchors the beginning of line. |
$ |
Matches/anchors the end of line. |
x|
y |
Causes the regex engine to match either
the part on the left side, or the part on the right side. |
* |
Matches the preceding character zero or
more times. |
+ |
Matches the preceding character one or
more times. Does not match repeated newlines. |
? |
Matches any single character except
newline. |
{n} |
Repeats the previous item exactly n
times. |
{m,n} |
Repeats the previous item between m and n
times. |
{m,} |
Repeats the previous item at least m
times. |