Do a global search for characters that are NOT "i" and "s" in a string: - Javascript RegExp

Javascript examples for RegExp:Bracket

Description

Do a global search for characters that are NOT "i" and "s" 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() {//w w  w .java 2  s .com
    var str = "The following code shows how to this is a test";
    var patt1 = /[^is]/gi;
    var result = str.match(patt1);
    document.getElementById("demo").innerHTML = result;
}
</script>

</body>
</html>

Related Tutorials