JavaScript RegExp *Quantifier
JavaScript RegExp Object
Definition and Usage
n* Quantifier matches containing zero or morenany string.
Syntax
new RegExp("n*")
Or a simpler way:
/n*/
Or a simpler way:
/n*/
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support*the quantifier.
Examples
Example 1
Perform a global search for "l", including zero or more "o"s immediately following it:
var str="Hellooo World! Hello Example!";
var patt1=/lo*/g;
var patt1=/lo*/g;
Belowmarkedthe text shows the position where the expression obtains a match:
Hellooo World! Hello Example!
Try it yourself »
Example 2
Perform a global search for "1", including one or more "0"s immediately following it:
var str="1, 100 or 1000?";
var patt1=/10*/g;
var patt1=/10*/g;
Belowmarkedthe text shows the position where the expression obtains a match:
1, 100 or 1000?
Try it yourself »
JavaScript RegExp Object Other Extensions