Use Regex for url followed by certain text - Javascript RegExp

Javascript examples for RegExp:Match URL

Description

Use Regex for url followed by certain text

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 .jav  a  2 s. c o m*/
var text = 'https://drive.google.com/open?id=123123123';
var result = text.replace('https', 'http').replace('open?', 'uc?export=view&');
console.log(result);
    }

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

Related Tutorials