From n to m occurrences
The {} braces support three forms:
{n}— exactly n (lesson 4){n,}— n or more, no upper bound{n,m}— between n and m, inclusive
Pattern \d{3,4} matches 3 OR 4 digits. Pattern a{2,} matches 2 or more a's. Pattern x{0,5} matches 0 to 5 x's (similar to x* but capped at 5).
Equivalences worth knowing
The basic quantifiers are shortcuts for {} ranges:
*is{0,}+is{1,}?is{0,1}
You'll never write {0,} in real code — * is shorter. But knowing the equivalence makes the family feel coherent.
The flavor wart: comma whitespace
Most engines require NO whitespace inside {}. {3, 5} with a space is interpreted differently across flavors — sometimes as a literal, sometimes as an error, almost never as {3,5}. Always write {n,m} tight.