Do a global search for the character-span NOT from lowercase "a" to lowercase "h" in a string: - Javascript RegExp

Javascript examples for RegExp:Bracket

Description

Do a global search for the character-span NOT from lowercase "a" to lowercase "h" 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   w  w  w . j  a va 2  s .  co m*/
    var str = "Is this all there is The following code shows how to ?";
    var patt1 = /[^a-h]/g;
    var result = str.match(patt1);
    document.getElementById("demo").innerHTML = result;
}
</script>

</body>
</html>

Related Tutorials