ignoreCase is an property in JavaScript Regular expressions, which is used to find whether "i" modifier is set or not for the case-insensitive search.
It is an boolean type property, If "i" modifier is set for the search, the ignoreCase property returns "true", other wise it returns "false".
<p>Click the below button to find whether "i" modifier is set or not.</p> <input type="button" value="Search" onclick="testFunction()"/> <p id="myId"></p> <script> function testFunction() { var a = "TechFunda Provides lot technology " var b = /lot/i; var r = b.ignoreCase; document.getElementById("myId").innerHTML = r; } </script>
In the above code snippet we used "i" modifier for the case-insensitive search. We are checking whether "i" modifier is set or not by using ignoreCase property.
Onclick button finds whether "i" modifier is set or not and return the output.
OUTPUT
<p>Click the below button to find whether "i" modifier is set or not.</p> <input type="button" value="Search" onclick="testFunction()"/> <p id="myId"></p> <script> function testFunction() { var a = "TechFunda Provides lot technology " var b = /lot/g; var r = b.ignoreCase; document.getElementById("myId").innerHTML = r; } </script>
ignoreCase property without "i" modifier
In the above code snippet we used "g" modifier for the global search.
OUTPUT
Views: 5866 | Post Order: 153