Java Reference
In-Depth Information
Subexpression
Matches
Notes
{
m
,
n
}
Quantifier for “from
m
to
n
repetitions”
Quantifier for "
m
or more repetitions”
{
m
,}
Quantifier for “exactly
m
repetitions”
{
m
}
{
,
n
}
Quantifier for 0 up to
n
repetitions
Quantifier for 0 or more repetitions
Short for
{0,}
\*
Quantifier for 1 or more repetitions
+
Quantifier for 0 or 1 repetitions (i.e.,
present exactly once, or not at all)
Short for
{0,1}
?
Reluctant (non-greedy)
quantifiers
{
m
,
n
}?
Reluctant quantifier for “from
m
to
n
repeti-
tions”
Reluctant quantifier for "
m
or more repeti-
tions”
{
m
,}?
{
,
n
}?
Reluctant quantifier for 0 up to
n
repetitions
Reluctant quantifier: 0 or more
\*?
Reluctant quantifier: 1 or more
+?
Reluctant quantifier: 0 or 1 times
??
Possessive (very greedy)
quantifiers
{
m
,
n
}+
Possessive quantifier for “from
m
to
n
repeti-
tions”
Possessive quantifier for "
m
or more repeti-
tions”
{
m
,}+