Latest

recent

JavaScript RegExp {x} Modifier

Definition and Usage

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

Syntax

/regexp{x}/

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


Example

In the following code we will do a search for any substring with four digits:

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

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

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