Mega Code Archive

 
Categories / JavaScript DHTML / Development
 

String match pattern

<html>   <head>     <script type="text/javascript">             var pattern = /is (.*) test/;             var string = "this is a test";             var result = string.replace(pattern, "not unit $1 test");                          document.write(result);        </script>   </head>   <body>   </body> </html>