String replace with regular expression
<html> <head> <title></title> <script type="text/javascript"> var pattern = /test/; var string = "this is a test"; var result = string.replace(pattern, " unit test"); document.write(result); </script> </head> <body> </body> </html>