RegExp ignoreCase Property - Javascript RegExp

Javascript examples for RegExp:Property

Description

The ignoreCase property sets whether or not the "i" modifier is set.

This property returns true if the "i" modifier is set, otherwise it returns false.

Return Value

TypeDescription
Boolean Returns true if the "i" modifier is set, false otherwise

The following code shows how to Check whether or not the "i" modifier is set:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  w w  w .j  a v  a2  s.c om
    var str = "The following code shows how to !";
    var patt1 = /code/i;
    var res = patt1.ignoreCase;
    document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>

Related Tutorials