10.07.2017 Views

javascript_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Javascript<br />

Try the following example program.<br />

<br />

<br />

JavaScript RegExp global Property<br />

<br />

<br />

<br />

var re = new RegExp( "string" );<br />

if ( re.global ){<br />

document.write("Test1 - Global property is set");<br />

}else{<br />

document.write("Test1 - Global property is not set");<br />

}<br />

re = new RegExp( "string", "g" );<br />

if ( re.global ){<br />

document.write("Test2 - Global property is set");<br />

}else{<br />

document.write("Test2 - Global property is not set");<br />

}<br />

<br />

<br />

<br />

Output<br />

Test1 - Global property is not set<br />

Test2 - Global property is set<br />

ignoreCase<br />

ignoreCase is a read-only boolean property of RegExp objects. It specifies<br />

whether a particular regular expression performs case-insensitive matching, i.e.,<br />

whether it was created with the "i" attribute.<br />

314

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!