JavaScript RegExp global property

Definition and usage

global The property specifies whether the 'g' modifier is set.

If set "g" modifier, then this property returns true, otherwise returns false.

Description

The RegExp object's global The property is a read-only boolean value.

It specifies whether the regular expression performs a global match, such as whether the flag g was used when it was created.

Example

let pattern = /W3S/g;
let result = pattern.global;

Try it yourself

Syntax

regexp.global

Return value

Type Description
Boolean value Returns true if the 'g' modifier is set, otherwise returns false.

Browser support

global It is a feature of ECMAScript1 (ES1).

All browsers fully support ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support