Home  >  Article  >  Web Front-end  >  How to perform multi-line matching using JavaScript RegExp?

How to perform multi-line matching using JavaScript RegExp?

WBOY
WBOYforward
2023-08-29 17:21:031011browse

如何使用JavaScript RegExp执行多行匹配?

#To perform multi-line matching, use the M modifier provided in JavaScript regular expressions.

Example

You can try running the following code to perform multi-line matching -

<html>
   <head>
      <title>JavaScript Regular Expression</title>
   </head>

   <body>
      <script>
         var myStr = "Welcoming!";
         var reg = /^ing/m;
         var match = myStr.match(reg);
         
         document.write(match);
      </script>
   </body>
</html>

The above is the detailed content of How to perform multi-line matching using JavaScript RegExp?. 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