RegExp {X, Y} quantifier
Definition and Usage
n{X, Y} quantifier matches comprising at least a sequence of X up to Y n of a string
XandYmust be numeric.
grammar
new RegExp("n{X,Y}")
或者更简单方式:
/n{X,Y}/
或者更简单方式:
/n{X,Y}/
Browser Support
All major browsers support {X, Y} quantifier.
Examples
Examples
Of the sub-sequence contains three or four digits of the global search string:
var str="100, 1000 or 10000?";
var patt1=/d{3,4}/g;
var patt1=/d{3,4}/g;
The marked text below shows where the expression gets a match:
100 , 1000 or 1000 0?
try it"
JavaSript RegExp objects