How to find a character, not between the brackets in JavaScript RegExp?

HTMLJavascriptProgramming Scripts

To find a character, not between brackets, you need to add the character like the following −

[^...]

Example

You can try to run the following code to learn how to find a character, not between the brackets −

<html>
   <head>
      <title>JavaScript Regular Expression</title>
   </head>
   <body>
      <script>
         var myStr = "Welcome! Welcome to the website!";
         var reg = /[^m]/g;
         var match = myStr.match(reg);
         
         document.write(match);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 06:09:16
Advertisements