Say I have a date string in the form of "11.23.13" and I want to replace every dot with a "/" so it looks like "11/23/13".
Here's my code but it's not working correctly because regular expression sees the "." and interprets that as matching every single character instead of new lines. So instead of "11/23/13", I get "////////".
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>RegExMatchDot</title>
<script type="text/javascript">
var myDate = "11.23.13";
var myDateWithNewSeparator = myDate.replace(new RegExp(".", "g"), "/");
console.log("my date with new date separator is: ", myDateWithNewSeparator);
</script>
</head>
<body>
</body>
</html>
Anyone know a way around this issue? Thanks!
new RegExp("\\.", "g")