Quantifiers and Greedy vs Lazy MatchingLesson 4.4
Exact and range quantifiers in regex
exact quantifier, minimum quantifier, range quantifier, phone number pattern, input length validation, combining with anchors
Control Match Length Precisely
When * and + are too loose, use curly-brace quantifiers to specify exact or bounded repetition.
{n}— exactly n times{n,}— at least n times{n,m}— between n and m times (inclusive)
/^\d{10}$/.test('4155550000') // true — exactly 10 digits
/^\d{6,8}$/.test('123456') // true — 6 digits
Always combine curly quantifiers with anchors for validation.
