Repetition
Fixed repetition
The quantifier {n}, where n is an nonnegative integer, repeats the preceding regex token n times
regex
\b\d{100}\b1
\d\d{0}is equivalent to\d\d\d{1}is equivalent to\d\d
Variable repetition
The quantifier {n,m}, where n is an nonnegative integer, and m is an nonnegative integer greater than n.
The following matches 1 to 8 digits:
regex
\b\d{1,8}\b1
\d{10,10}is equivalent to\d
Infinite repetition
\d{n,}matchesnor more times of digits\d{1,}is equivalent to\d+\d{0,}is equivalent to\d*
Optional match
\d{0,1}marks the digit can be omit in context\d{0,1}is equivalent to\d?- matches empty string when the preceding token is absent
Repeating groups
(?:abc){1,3}matches one to three occurrences ofabc(?:abc)+matches one or more occurrences ofabc(?:abc)?matches anyabcand empty strings