### Metacharacters

Metacharacters express sets of characters or special characters.

.
any character
^
beginning of a line
$
end of a line
\
quotes special characters (* ? + [ ] ( ) { } ^ $ | \ . / )
\w
word
\t
horizontal tabulation
\n
new line
\d
any digit
\s
white space character (\t \n \f \r \p{Z})
[…]
match any character (or range of characters) inside the brackets. Range may be e.g. [a-z], [A-Z], [3…5], etc.
\D
any character that is not a decimal digit
\S
non-white space character
\W
non-word character

### Operators

Operators allow to describe how an expression (or subexpression) should be matched.

(…)
groups expression into subexpressions
A|B
alternation. Matches A or B
^
negation
*
match 0 or more times
+
match 1 or more times
?
match zero or one times
{n}
match exactly n times
{n,m}
match at least n time and not more than m

### Non-capturing operators

These operators work by one simple rule. They are not captured in groups.

(?#…)
Comment
(?:…)
Subexpression must occur but it's not captured in group.
(?!…)
Makes sure that the subexpression does not occur at current position. It's useful to exclude part of expression.