| Character | Meaning |
|---|---|
\
|
For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally.
For example,
or For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally.
For example, * is a special character that means 0 or more occurrences of the preceding character should be matched; for example,
|
^
|
Matches beginning of input. If the multiline flag is set to true, also matches immediately after a line break character.
For example,
|
$
|
Matches end of input. If the multiline flag is set to true, also matches immediately before a line break character.
For example,
|
*
|
Matches the preceding item 0 or more times.
For example,
|
*?+???{}?
|
Lazy repetition. Works like */+/? but will stop matching after the first occurance of the following character.
For example,
|
+
|
Matches the preceding item 1 or more times. Equivalent to
For example,
|
?
|
Matches the preceding item 0 or 1 time.
For example,
If used immediately after any of the quantifiers
Also used in lookahead assertions, described under
|
.
|
(The decimal point) matches any single character except the newline characters: \n \r \u2028 or \u2029. (
For example,
|
(
x
)
|
Matches
For example,
|
(?:
x
)
|
Matches
|
x
(?=
y
)
|
Matches
|
x
(?!
y
)
|
Matches
|
x
|
y
|
Matches either
For example,
|
{
n
}
|
Where
For example,
|
{
n
,}
|
Where
For example,
|
{
n
,
m
}
|
Where
For example,
|
[
xyz
]
|
A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen.
For example,
|
[^
xyz
]
|
A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen.
For example,
|
[\b]
|
Matches a backspace. (Not to be confused with
|
\b
|
Matches a word boundary, such as a space. (Not to be confused with
For example,
|
\B
|
Matches a non-word boundary.
For example,
|
\c
X
|
Where
For example,
|
\d
|
Matches a digit character in the basic Latin alphabet. Equivalent to
Note : In Firefox 2 and earlier, matches a digit character from any alphabet. ( bug 378738 )
For example,
|
\D
|
Matches any non-digit character in the basic Latin alphabet. Equivalent to
Note : In Firefox 2 and earlier, all alphabet. ( bug 378738 )
For example,
|
\f
|
Matches a form-feed. |
\n
|
Matches a linefeed. |
\r
|
Matches a carriage return. |
\s
|
Matches a single white space character, including space, tab, form feed, line feed and other unicode spaces. equivalent_s
For example,
|
\S
|
Matches a single character other than white space. equivalent_S
For example,
|
\t
|
Matches a tab. |
\v
|
Matches a vertical tab. |
\w
|
Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to
For example,
|
\W
|
Matches any character that is not a word character from the basic Latin alphabet. Equivalent to
For example,
|
\
n
|
Where
For example,
|
\0
|
Matches a NUL character. Do not follow this with another digit. |
\x
hh
|
Matches the character with the code
|
\u
hhhh
|
Matches the character with the Unicode value
|