Easy Tutorial
❮ Js Window History Js Syntax ❯

JavaScript RegExp g Modifier


Definition and Usage

The g modifier is used to perform a global match (find all matches rather than stopping after the first match).

Syntax


Browser Support

All major browsers support the g modifier.


Examples

Example 1

Performing a global search for "is":

The text highlighted below shows where the expression matches: is all there is?

Example 2

Performing a global and case-insensitive search for "is":

The text highlighted below shows where the expression matches: Is this all there is?


❮ Js Window History Js Syntax ❯