📅  最后修改于: 2022-03-11 15:01:20.106000             🧑  作者: Mango
let multilineString = `My
text\r1\r\n2\n3\n\r4
is
here`;
let htmlText = multilineString.replace(/(\r\n|\n\r|\r|\n)/g, '
');
console.log('Multiline string: ' + multilineString);
console.log('HTML text: ' + htmlText);