hankknight
asked on
JavaScript: Replace \n and \r with <br />
I want to replace both \n and \r with <br />
The code below does NOT work:
The code below does NOT work:
<script type="text/javascript">
var xyz = 'Hello, world. \r This is at test\n and only \n a test \r!!!';
xyz = xyz.replace(/[\n+][\r+]/g, "<br />");
alert(xyz);
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.