how to remove \n\r from string node js code example
Example 1: javascript replace \n
var r = "I\nam\nhere";
var s = r.replace(/\n/g,' ');
Example 2: javascript replace with n
var str = $("#mydiv").html();
var regex = /<br\s*[\/]?>/gi;
$("#mydiv").html(str.replace(regex, "\n"));