Java Reference
In-Depth Information
Regular Expression
Matches
x
The character x
.
Any character
[ abc]
a, b, or c
[^abc]
Any character except a, b, or c (negation)
[a-z][A-Z]
a through z or A through Z, inclusive (range)
[a-d[m-p]]
a through d or m through p (union)
[a-z&&[ def]]
d, e, or f (intersection)
[a-z&&[ ^bc]]
a through z, except for b and c (subtraction)
[a-z&&[ ^m-p]]
a through z but not m through p (subtraction)
\d
A digit: [0-9]
\D
A non-digit: [^0-9]
\s
A whitespace character
\S
A non-whitespace character
^
The beginning of a line
$
The end of a line
FIGURE H.1
Some patterns that can be matched in a Java regular expression
Search WWH ::




Custom Search