Find the non-digit character with JavaScript Regular Expression.

HTMLJavascriptProgramming Scripts

To find non-digit characters with JavaScript Regular Expression, use the following:

\D

Example

You can try to run the following code to find non-digit characters:

<html>
   <head>
      <title>JavaScript Regular Expression</title>
   </head>

   <body>
      <script>
         var myStr = "100% Responsive!";
         var reg = /\D/g;
         var match = myStr.match(reg);
         
         document.write(match);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 06:39:36
Advertisements