Syntax error Match any single character in the given set.

Match any single character in the given set.



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>
Updated on: 2020-01-20T11:00:37+05:30

110 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements