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 property of RegExp object 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 If the "g" modifier is set, returns true, otherwise returns false.

Browser support

global To ECMAScript1 (ES1) feature.

Wszystkie przeglądarki obsługują w pełni ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Wsparcie Wsparcie Wsparcie Wsparcie Wsparcie Wsparcie