Quantifiers

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

Note: The .NET Framework regular expressions support minimal matching (i.e., "lazy") quantifiers.

Regular Expression Description
* Zero or more matches. For example, \w* or (abc)*. Equivalent to {0,}.
+ One or more matches. For example, \w+ or (abc)+. Equivalent to {1,}.
? Zero or one matches. For example, \w? or (abc)?. Equivalent to {0,1}.
{n} Exactly n matches. For example, (pizza){2}.
{n,} At least n matches. For example, (abc){2,}.
{n,m} At least n, but no more than m, matches.