JavaScript globalProperty
JavaScript RegExp Object
Definition and Usage
The global property is used to return whether the regular expression has "g" 。
If the g flag is set, this property is true, otherwise it is false.
Syntax
RegExpObject.global
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the global property.
Example
Example
Check whether the regular expression has the g flag:
var str="Visit EXAMPLE!";
var patt1=/RUN/g;
if(patt1.global)
{
document.write("The g mode is set!");
}
else
{
document.write("The g mode is not set!");
}
Try it Yourself »
JavaScript RegExp Object Other Extensions