Find digits between brackets in JavaScript RegExp?

HTMLJavascriptProgramming Scripts

To match any decimal digit between 0 through 9, follow the following pattern −

[0-9]

Example

You can try to run the following code to learn how to find digits 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 06:09:58
Advertisements