JavaScript RegExp {x,} Modifier

Definition and Usage

When the {x,} modifier is set the regular expression finds a specific number or more of the regular expression grouped together.
The character inside the brackets must be a number.



Parameter Description
regexp Required. The rest of the regular expression to use


In the following code we will do a global search for any substring with three or more digits:

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

The marked text below shows where the RegExp gets a match:

100 or 1000?
JavaScript RegExp {x,} Modifier Reviewed by 1000sourcecodes on 21:45 Rating: 5
Powered by Blogger.