The Backslash in RegExp : Regular Expressions « Development « JavaScript DHTML
- JavaScript DHTML
- Development
- Regular Expressions
The Backslash in RegExp
<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>
Related examples in the same category