HTML and CSS Reference
In-Depth Information
Table 17.6
Metacharacters and Metasymbols (continued)
Metacharacter/Met
asymbol
What It Matches
Character Class: Anchored Characters
^
Matches to beginning of line
$
Matches to end of line
\A
Matches the beginning of the string only
\b
Matches a word boundary (when not inside
[ ]
)
\B
Matches a nonword boundary
\G
Matches where previous
m//g
left off
\Z
Matches the end of the string or line
\z
Matches the end of string only
Character Class: Repeated Characters
x?
Matches 0 or 1 of
x
x*
Matches 0 or more of
x
x+
Matches 1 or more of
x
(xyz)+
Matches one or more patterns of
xyz
x{m,n}
Matches at least
m
of
x
and no more than
n
of
x
Character Class: Alternative Characters
was|were|will
Matches one of
was, were,
or
will
Character Class: Remembered Characters
(string)
Used for backreferencing (see the section “Remembering or
Capturing” on page 762)
\1
or
$1
Matches first set of parentheses
\2
or
$2
Matches second set of parentheses
\3
or
$3
Matches third set of parentheses
Continues