JavaScript global Property
Example
Check whether or not the "g" modifier is set:
var str = "Visit W3Schools!";
var patt1 = /W3S/g;
var res =
patt1.global;
The result of res will be:
true
Try it Yourself »
Definition and Usage
The global property specifies whether or not the "g" modifier is set.
This property returns true if the "g" modifier is set, otherwise it returns false.
Browser Support
Property | |||||
---|---|---|---|---|---|
global | Yes | Yes | Yes | Yes | Yes |
Syntax
RegExpObject.global
Return Value
Type | Description |
---|---|
Boolean | Returns true if the "g" modifier is set, false otherwise |
Technical Details
JavaScript Version: | 1.2 |
---|
JavaScript RegExp Object