match random string between quotes using Regex - Javascript String Operation

Javascript examples for String Operation:String Quote

Description

match random string between quotes using Regex

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(){//  w  ww .  j a  v a 2 s.  co m
var string = 'rpc=a7" class="picker" name="m7" id="ja" frameborder="0"></iframe></div><div style="display: none;"';
var regex = /name=\"([^"]+)\"/g;
var match = regex.exec(string);
console.log(match[1]);  

    }

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

Related Tutorials