RegExp i Modifier - Javascript RegExp

Javascript examples for RegExp:Modifier

Description

The i modifier does a case-insensitive matching.

Syntax

The following code shows how to Do a case-insensitive search for "book2s" in a string:

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   ww  w.ja  va2 s  .  co  m*/
    var str = "The following code shows how to do java2s.com!";
    var patt1 = /book2s/i;
    var res = patt1.ignoreCase;
    document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>

Related Tutorials