The {X,} quantifier matches the previous token at least X times with no upper limit. Use \d{3,} for three-or-more digits, {8,} for minimum password length, and remember that + is shorthand for {1,}.
01
{n,}
At least n
02
{1,}
Same as +
03
{0,}
Same as *
04
vs {n}
Exact count
05
Greedy
Max match
06
{n,}?
Lazy mode
Fundamentals
Introduction
Exact counts like {4} are perfect when length is fixed. But many rules only set a minimum: passwords must be at least eight characters, numbers need three or more digits, and repeated spaces should collapse to one. The {X,} quantifier handles that—at least X repetitions, as many as needed.
You already know + (one or more) and * (zero or more). Brace notation makes the minimum explicit: {1,} equals +, and {0,} equals *. Writing {3,} is clearer than guessing what “three or more” means in a complex pattern.
Concept
Understanding the {X,} At-Least Quantifier
Place {n,} after a token, where n is a non-negative integer. The engine matches that token at least n times in a row, then continues greedily if more matches are available.
JavaScript
/\d{3,}/.test("12"); // false — fewer than 3 digits
/\d{3,}/.test("123"); // true
/\d{3,}/.test("12345"); // true — more than 3 is allowed
"a{2,}".replace(/a{2,}/, "X"); // "X" from "aaa"
Unlike {n}, which stops at exactly n, {n,} has no maximum. The match grows until the token no longer applies or the rest of the pattern requires stopping (with backtracking if needed).
💡
Beginner Tip
In tutorials we write {X,} as a placeholder. In real patterns, replace X with a number: {3,}, {8,}. The trailing comma is required—{3} without a comma means exactly three, not three or more.
Usage
How to Use the {X,} Quantifier
Attach {n,} after a character class, metacharacter, dot, or grouped expression:
JavaScript
/\d{3,}/; // three or more digits
/^.{8,}$/; // at least 8 characters (whole field)
/\s{2,}/g; // two or more whitespace chars
/(ha){2,}/; // ha repeated at least twice
/\w{1,}/g; // same idea as \w+
Use test() for yes/no checks, match() with g to find all qualifying runs, and ^…$ when the entire input must meet a minimum length.
Foundation
📝 Syntax
JavaScript
token{n,} // at least n repetitions, no max
{1,} // one or more (same as +)
{0,} // zero or more (same as *)
\d{3,} // 3+ digits
.{8,} // 8+ any chars
\s{2,} // 2+ whitespace chars
Common patterns
/\d{3,}/ — find digit runs of three or more characters.
/^.{8,}$/ — password or field with minimum eight characters.
/\s{2,}/g — detect double (or more) spaces for cleanup.
/[A-Z]{2,}/ — two or more consecutive uppercase letters.
/(ab){2,}/ — at least two full ab group repetitions.
Use {n,} when a minimum is enough; use {n} when length must be precise.
At least 2
a{2,}
Matches aa, aaa, aaaa…
Exactly 2
a{2}
Matches only aa
One or more
a+
Same as a{1,}
Zero or more
a*
Same as a{0,}
Hands-On
Examples Gallery
Open DevTools Console (F12) or use Try-it links. Examples cover minimum digit runs, exact vs at-least comparison, password length rules, whitespace cleanup, and grouped repetition.
📚 Getting Started
Require a minimum number of repetitions.
Example 1 — Match Three or More Digits with \d{3,}
Find digit runs where at least three digits appear in a row.
{3,} sets a floor of three digits but allows longer runs. "12345" matches the entire five-digit sequence greedily. Two-digit values like "12" fail the minimum.
📈 Practical Patterns
Compare quantifiers, validate length, and clean text.
Example 2 — {2} Exact vs {2,} At-Least
See how adding a comma changes the rule from “exactly two” to “two or more.”
Both patterns match "aa" and find a valid run inside "aaa". The difference shows when you need an upper bound: {2} alone does not cap length—use {2,2} or anchors for strict two-character fields. {2,} explicitly documents “minimum two.”
Example 3 — Minimum Password Length with {8,}
Require at least eight characters for the entire input.
The dot matches any character; {8,} requires at least eight. Anchors ensure the whole string is measured, not a substring. Add character-class rules for letters, digits, or symbols separately.
Example 4 — Collapse Repeated Spaces with \s{2,}
Find two or more whitespace characters and replace them with a single space.
\s{2,} matches runs of spaces, tabs, or other whitespace that are at least two characters long. The global flag finds every run; replace normalizes them to one space.
Example 5 — Repeat a Group at Least Twice with (ha){2,}
Match laughter or rhythmic text where ha appears two or more times.
JavaScript
const words = ["ha", "haha", "hahaha", "hahahaha"];
words.forEach((w) => {
console.log(w, /(ha){2,}/.test(w));
});
// ha false — only one ha unit
// haha true
// hahaha true
// hahahaha true
The {n,} at-least quantifier is part of core JavaScript regular expression syntax.
✓ Baseline · ES3+
RegExp {n,} quantifier
Supported in every browser and Node.js version. Use {n,} when a minimum repetition count is required.
99%Universal syntax
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
{n,}Excellent
Bottom line: Safe everywhere. {n,} is the explicit form of open-ended minimum repetition.
Wrap Up
Conclusion
The {X,} quantifier matches the previous token at least X times with no upper limit. It powers minimum-length validation, long digit runs, whitespace cleanup, and any rule where “at least n” is enough. Remember that + and * are compact forms of {1,} and {0,}.
Watch the trailing comma, use groups when whole sequences repeat, and add anchors for full-field checks. When you also need a maximum, move on to {X,Y} bounded ranges.
Use {n,} when the minimum count matters and length is unbounded
Write {3,} instead of + when clarity helps teammates
Combine ^.{n,}$ for minimum whole-field length
Wrap repeating sequences in (…){n,}
Try {n,}? when greedy matching consumes too much
❌ Don’t
Confuse {3} (exact) with {3,} (at least)
Use {n,} when you also need a maximum—use {n,m}
Forget anchors when validating entire input length
Write ab{2,} when you mean (ab){2,}
Rely on regex alone for password strength—check content rules too
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about the RegExp {X,} quantifier
Match minimum repetition counts with confidence.
5
Core concepts
🔢01
{n,}
At least n.
Syntax
📈02
{1,}
Same as +.
Shorthand
📄03
vs {n}
Exact count.
Compare
🔒04
^.{8,}$
Min length.
Validate
🚫05
Comma
Required.
Pitfall
❓ Frequently Asked Questions
The {X,} quantifier (use a number instead of X, such as {3,}) means at least X repetitions of the preceding token with no upper limit. Example: \d{3,} matches three digits, four digits, or any longer digit run.
{X} requires exactly X repetitions—no more, no fewer. {X,} requires at least X but allows more. So /a{2}/ matches only aa, while /a{2,}/ matches aa, aaa, aaaa, and so on.
Yes. The + quantifier is shorthand for {1,}—one or more repetitions. Both are greedy by default. Use whichever reads more clearly in your pattern.
Yes. The * quantifier means zero or more, which is equivalent to {0,}. Again, both are greedy unless you add ? for lazy matching.
Yes. Append ? after the quantifier for lazy (minimal) matching: /\d{3,}?/ matches as few digits as possible while still meeting the minimum of three.
Brace quantifiers including {n,} are core JavaScript regex syntax since ES3. They work in every browser and Node.js version without polyfills.
Did you know?
The comma in {n,} is what makes the quantifier open-ended. Without it, {3} means exactly three. With it, {3,} means three or more. That single punctuation mark is one of the most important details in brace quantifier syntax.