RegExp m Modifier - Javascript RegExp

Javascript examples for RegExp:Modifier

Description

The m modifier does a multiline match.

To perform a global, case-insensitive, multiline search, use this modifier together with "g" and "i".

The following code shows how to tell if it is doing multiline search:

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.ja  va  2s.  c  o  m
    var str = "The following code shows how to ";
    var patt1 = /to/gi;
    var res = patt1.multiline;
    document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>

Related Tutorials