Javascript examples for String:replace
Add a random string between filename and file extension in JavaScript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w.ja va2 s.c o m console.log('testtesttest'.replace(/(\.[^\.]*)?$/, '.foo$1')); } </script> </head> <body> </body> </html>