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
See Matching Newlines in Text
\n
Form feed
\f
Character in a word
Use \w+ for a word; see Program:
Apache Logfile Parsing
\w
A nonword character
\W
Numeric digit
Use \d+ for an integer; see Using
regexes in Java: Test for a Pattern
\d
A nondigit character
\D
Whitespace
Space, tab, etc., as determined by
java.lang.Character.isWhitespace()
\s
A nonwhitespace character
See Program: Apache Logfile
Parsing
\S
Search WWH ::




Custom Search