Regex Multiline mode - Javascript RegExp

Javascript examples for RegExp:RegExp Match

Description

Regex Multiline mode

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from  w w w  .  j  a v a 2 s.  com*/
var str = "Item zero is blah\nJoe's item list \nItem one is Abc\nItem two is xyz\nItem three is 123\nItem four is test but this shouldn't match\nEnd of Item List "
var matches = str.match(/^Item (\w+) is (\w+)$/gm);
console.log(matches);
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials