User Guide

292 Using Regular Expressions
However, the three characters listed in the following table do function as metacharacters, with
special meaning, in character classes:
For any of these characters to be recognized as literal characters (without the special
metacharacter meaning), you must precede the character with the backslash escape character.
For example, the following regular expression includes a character class that matches any one
of four symbols (
$, \, ], or -):
/[$\\\]\-]/
In addition to the metacharacters that retain their special meanings, the following
metasequences function as metasequences within character classes:
Other regular expression metasequences and metacharacters are treated as normal characters
within a character class.
Ranges of characters in character classes
Use the hyphen to specify a range of characters, such as A-Z, a-z, or 0-9. These characters
must constitute a valid range in the character set. For example, the following character class
matches any one of the characters in the range
a-z or any digit:
/[a-z0-9]/
Metacharacter Meaning in character classes
]
Defines the end of the character class.
-
Defines a range of characters (see “Ranges of characters in
character classes” on page 292).
\
Defines metasequences and undoes the special meaning of
metacharacters.
Metasequence Meaning in character classes
\n
Matches a newline character.
\r
Matches a return character.
\t
Matches a tab character.
\unnnn
Matches the character with the specified Unicode code point value
(as defined by the hexidecimal number
nnnn).
\xnn
Matches the character with the specified ASCII value (as defined by
the hexidecimal number
nn).