\w,
Matches any alphanumeric character including the underscore.
.,
Matches any single character except the newline character, by default.
*,
Matches the preceding expression 0 or more times. Equivalent to {0,}.
\, backslash.
[\b],
Matches a backspace (U+0008).
^,
Matches beginning of input.
If the multiline flag is set to true, also matches immediately after a line break character.
\r,
Matches a carriage return (U+000D).
i,
Case-insensitive search.
\d, Matches a digit character. Equivalent to [0 - 9].
.,
Matches any single character except the newline character, by default.
s,
Allows . to match newline characters.
$,
Matches end of input.
If the multiline flag is set to true, also matches immediately before a line break character.
\f,
Matches a form feed (U+000C).
g,
Global search.
\n,
Matches a line feed (U+000A).
*,
Matches the preceding expression 0 or more times. Equivalent to {0,}.
n,
Multi-line search.
\D, Matches a non-digit character. Equivalent to [^ 0 - 9].
\S,
Matches a character other than white space.
\W,
Matches any non-word character.
\B, Matches a non-word boundary.
\0, Matches a NULL (U+0000) character.
+,
Matches the preceding expression 1 or more times. Equivalent to {1,}.
+,
Matches the preceding expression 1 or more times. Equivalent to {1,}.
?,
Matches the preceding expression 0 or 1 time. Equivalent to {0,1}.
y,
Perform a "sticky" search that matches starting at the current position in the target string.
\t,
Matches a tab (U+0009).
u,
"unicode"; treat a pattern as a sequence of unicode code points.
\v,
Matches a vertical tab (U+000B).
\s,
Matches a white space character, including space, tab, form feed, line feed.
\b
Matches a word boundary.
?
Matches the preceding expression 0 or 1 time. Equivalent to {0,1}.
\n,
Where n is a positive integer,
a back reference to the last substring matching the n parenthetical
in the regular expression (counting left parentheses).
(x), Matches x and remembers the match.
The parentheses are called capturing parentheses.
(?<name>:x), Named capturing group: Matches x and stores it
on the groups property of the returned matches under the name specified by
expression
name
[xyz],
Character set.
\cX
Matches a control character in a string.
a character ranging from A to Z.
\xhh,
Matches the character with the code hh.
two hexadecimal digits
x(?=y),
Matches x only if x is followed by y. This is called a lookahead.
expression
the followed by expression
(?<=y)x,
Matches x only if x is preceded by y.
This is called a lookbehind.
expression
the preceded by expression
[^xyz],
A negated or complemented character set.
x(?!y)
Matches x only if x is not followed by y.
This is called a negated lookahead.
expression
the not followed by expression
(?<!y)x,
Matches x only if x is not preceded by y.
This is called a negated lookbehind.
expression
the not preceded by expression
(?:x), Matches x but does not remember the match.
The parentheses are called non-capturing parentheses.
expression
{n},
Matches exactly n occurrences of the preceding expression. N must be a positive integer.
times of occurrences
(n, }, {n, m},
Matches at least n occurrences of the preceding expression. N must be a positive integer.
Where n and m are positive integers and n <= m.
Matches at least n and at most m occurrences of the preceding expression.
When m is omitted, it's treated as ∞.
at least occurrences
(optional) at most occurrences
x|y,
Matches 'x', or 'y' (if there is no match for 'x').
expression
\uhhhh
Matches the character with the code hhhh.
four hexadecimal digits
\u{hhhh}
(only when u flag is set)
Matches the character with the Unicode value hhhh (hexadecimal digits).
four hexadecimal digits
Generated using TypeDoc
Regular Expression Specification
Regular Expressions