Match any single character in the given set.

HTMLJavascriptProgramming Scripts

To match any single character in the given set with JavaScript RegExp, use the [aeiou] metacharacter.

Example

<html>
   <head>
      <title>JavaScript Regular Expression</title>
   </head>
   <body>
      <script>
         var myStr = "Welcome to our website!";
         var reg = /[we]/g;
         var match = myStr.match(reg);
         
         document.write(match);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 08:23:15
Advertisements