This appears to be working quite well `"abc\ndef\r\nghi\rjkl".replace(/(\r\n|\r)/g, '\n');`