Easy Tutorial
❮ Prop Color Type Event Onmouseover ❯

JavaScript RegExp * Quantifier


Definition and Usage

The * quantifier matches any string that contains zero or more occurrences of n.

Syntax


Browser Support

All major browsers support the * quantifier.


Examples

Example 1

Perform a global search for "l" followed by zero or more "o"s:

var str="Hellooo World! Hello tutorialpro!"; 
var patt1=/lo*/g;

The following marked text shows where the expression matches:

Hellooo World! Hello tutorialpro!

Example 2

Perform a global search for "1" followed by zero or more "0"s:

var str="1, 100 or 1000?";
var patt1=/10*/g;

The following marked text shows where the expression matches:

1, 100 or 1000?

❮ Prop Color Type Event Onmouseover ❯