Javascript examples for String:replace
Searching for values in string, then updating the string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript"> String.prototype.addLink = function(){ return this.replace(/(@(\w+))/g,'<a href="http://java2s.com/?q=$2">$1</a>'); }; document.write('some @test here'.addLink()); </script> </body>//from ww w . j a v a2s. co m </html>