We would like to know how to replace comma with another separator.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!--from w w w . j ava 2 s. co m-->
var string = "test, test2, test2, test4";
document.writeln(string.replace(/, /g, ', X'));
}
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: