Java Reference
In-Depth Information
Table 4-1. Regular expression metacharacter syntax
Subexpression
Matches
Notes
General
Start of line/string
\^
End of line/string
$
Word boundary
\b
Not a word boundary
\B
Beginning of entire string
\A
End of entire string
\z
End of entire string (except allowable final
line terminator)
\Z
.
Any one character (except line terminator)
“Character class”; any one character from
those listed
[…]
Any one character not from those listed
[\^…]
Alternation and Group-
ing
Grouping (capture groups)
(…)
Alternation
|
(?
:_
re
_
)
Noncapturing parenthesis
End of the previous match
\G
Back-reference to capture group number "
n
"
\
n
Normal (greedy) quanti-
fiers