Java Reference
In-Depth Information
Subexpression
Matches
Notes
{
,
n
}+
Possessive quantifier for 0 up to
n
repeti-
tions
Possessive quantifier: 0 or more
\*+
Possessive quantifier: 1 or more
++
Possessive quantifier: 0 or 1 times
?+
Escapes and shorthands
Escape (quote) character: turns most
metacharacters off; turns subsequent alpha-
betic into metacharacters
\
Escape (quote) all characters up to
\E
\Q
Ends quoting begun with
\Q
\E
Tab character
\t
Return (carriage return) character
\r
Newline character
\n
Form feed
\f
Character in a word
\w
A nonword character
\W
Numeric digit
\d
A nondigit character
\D
Whitespace
Space, tab, etc., as determined by
java.lang.Character.isWhitespace()
\s
A nonwhitespace character
\S