<html> <head> <title>The Backslash in RegExp</title> </head> <body> <script type="text/javascript"> var regExp = /\s\*/g; var str = "This *is *a *test *string"; var resultString = str.replace(regExp,'-'); document.writeln(resultString); </script> </body> </html>