Try thisthe following code,. It works on all platforms:.
var break_for_winDOS = 'test\r\nwith\r\nline\r\nbreaks'; var break_for_linux = 'test\nwith\nline\nbreaks'; var break_for_older_mac = 'test\rwith\rline\rbreaks'; break_for_winDOS.replace(/(\r?\n|\r)/gm, ' '); //output 'test with line breaks' break_for_linux.replace(/(\r?\n|\r)/gm, ' '); //output 'test with line breaks' break_for_older_mac.replace(/(\r?\n|\r)/gm, ' '); //output Output 'test with line breaks'