YouTip LogoYouTip

Jsref Regexp Global

JavaScript global Property | Tutorial

Tutorial -- Learning not just technology, but dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

JavaScript String Object

JavaScript Global Properties/Functions

JavaScript global Property

RegExp Object Reference Manual JavaScript RegExp Object


Definition and Usage

The global property is used to return whether a regular expression has the "g" flag.

If the g flag is set, this property is true; otherwise, it is false.

Syntax

RegExpObject.global


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The global property is supported by all major browsers.


Example

Example

Check if the regular expression has the g flag:

var str="Visit TUTORIAL!"; 
var patt1=/RUN/g; 
if(patt1.global){
    document.write("g The global flag is set.!"); 
}else{
    document.write("g The global flag is not set.!"); 
}

Try it yourself Β»


RegExp Object Reference Manual JavaScript RegExp Object

← Jsref Regexp IgnorecaseJsref Regexp Nfollow Not β†’