📌  相关文章
📜  javascript 用 br 替换换行符 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:27.328000             🧑  作者: 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);