Regular Expression Global Property

The Regular Expression Global property is a read-only property that indicates the value of the global attribute of an instance of the regular expression object. The value it returns depends on the attribute:

  • The value g is an attribute of the regular expression. It returns the following value:

    True

  • The value g is not an attribute of the regular expression. It returns the following value:

    False

Format

regexp.global

The following example uses the regular expression global property:

// Create RegExp instance with global attribute.
var pat = /^Begin/g;
//or
var pat = new RegExp("^Begin", "g");
//Then pat.global == true.