Easy Tutorial
❮ Prop Source Src Prop Loc Href ❯

JavaScript RegExp {X,Y} Quantifier

JavaScript RegExp Object


Definition and Usage

The n {X,Y} quantifier matches strings that contain a sequence of at least X and at most Y n's.

X and Y must be numbers.

Syntax


Browser Support

All major browsers support the {X,Y} quantifier.


Example

Perform a global search for a substring that contains sequences of three or four digits:

var str="100, 1000 or 10000?";
var patt1=/\d{3,4}/g;

The text below, marked, shows where the expression finds a match:

100, 1000 or 10000?

JavaScript RegExp Object

❮ Prop Source Src Prop Loc Href ❯