RegExp \D Metacharacter (uppercase D) - Javascript RegExp

Javascript examples for RegExp:Metacharacter

Description

The \D metacharacter matches a non-digit character.

The following code shows how to Do a global search for non-digit characters:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<button onclick="myFunction()">Test</button>

<script>
function myFunction()//from ww  w .ja  v  a  2  s.c o m
{
    var str = "this is a 100%!";
    var patt1 = /\D/g;
    var result = str.match(patt1);
    document.getElementById("demo").innerHTML=result;
}
</script>

</body>
</html>

Related Tutorials