Use regex to find and concatenating the particular strings - Javascript String Operation

Javascript examples for String Operation:String Replace

Description

Use regex to find and concatenating the particular strings

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 av a2 s.  co m
var s='This is a demo from "Java script". This Demo uses "Regex"';
var reg=/\"(.*?)\"/g;
var result=s.match(reg).join('+').replace(/"/g,"");
console.log(result);
    }

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

Related Tutorials