RegExp {n,m} Quantifier
A global search for a substring that contains a sequence of three to four digits:
let text = "100, 1000 or 10000?";
let pattern = /\d{3,4}/g;
let result = text.match(pattern);
Try it Yourself »
Description
The x{n,m} quantifier matches from n to m occurences of x.
n and m must be a number.
Syntax
new RegExp("x{n,m}")
or simply:
/x{n,m}/
Syntax with modifiers
new RegExp("x{n,m}", "g")
or simply:
/x{n,m}/g
Browser Support
/{n,m}/
is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |