Home  >  Article  >  Web Front-end  >  Search for tab characters using JavaScript regex

Search for tab characters using JavaScript regex

WBOY
WBOYforward
2023-08-30 10:53:181499browse

Search for tab characters using JavaScript regex

To find tab characters using JavaScript regular expressions, use the following command -

\t

Example

You can try running the following code to find tab characters. It returns the location where the tab (\t) character is found -

<html>
   <head>
      <title>JavaScript Regular Expression</title>
   </head>
   <body>
      <script>
         var myStr = "Simple \t Responsive!";
         var reg = /\t/;
         var match = myStr.search(reg);

         document.write(match);
      </script>
   </body>
</html>

The above is the detailed content of Search for tab characters using JavaScript regex. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete