Match string with regex - Javascript RegExp

Javascript examples for RegExp:RegExp Match

Description

Match string with regex

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width"> 
   </head> 
   <body> 
      <script>
const value = '<ns2:NewsPaper unitid="112234">';
const regex = /(unitid="[^"]+?")/;
const matches = value.match(regex);/*  www. ja v a 2  s  .  co  m*/
console.log(matches);

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

Related Tutorials