I am trying to replaces instances of \r
or \n
characters in my json object with <br />
for display on a website.
I tried:
myString = myString.replace("\\r?\\n", "<br />");
But this doesn't seem to do anything. When I replace the regex with something else (like "a"
for instance, the replace works as expected). Any ideas why this isn't working for the newline chars?