📜  用 html 换行符 js 替换换行符 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:20.106000             🧑  作者: Mango

代码示例2
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);