Find digits not between the brackets using JavaScript Regular Expressions?

HTMLJavascriptProgramming Scripts

To find digits, not between the brackets, follow the below-given pattern −

[^0-9]

Example

You can try to run the following code to learn how to find digits, not between brackets in JavaScript RegExp −

<html>
   <head>
      <title>JavaScript Regular Expression</title>
   </head>
   <body>
      <script>
         var myStr = "987654";
         var reg = /[^4-6]/g;
         var match = myStr.match(reg);
         
         document.write(match);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 10:45:11
Advertisements