Everything
B.4 Quantifiers

Quantifiers add optional quantity data to a regular expression. A quantifier expression applies to the character, group, or character class that immediately precedes it.

The following table describes the metacharacters that affect matching quantity:

Table B.5

List of Quantifiers

Quantifier

Description

*

Specifies zero or more matches; for example, \w* or (abc)*. Same as {0,}.

+

Specifies one or more matches; for example, \w+ or (abc)+. Same as {1,}.

?

Specifies zero or one matches; for example, \w? or (abc)?. Same as {0,1}.

{n}

Specifies exactly n matches; for example, (pizza){2}.

{n,}

Specifies at least n matches; for example, (abc){2,}.

{n,m}

Specifies at least n, but no more than m, matches.