我们为新员工提供入职表格,其中包含需要剥离的多个换行符(行间距为4-5行).我想摆脱额外的新行,但仍然用一个\n来区分块.
例:
New employee<br/> John Doe Employee Number<br/> 1234
我目前正在使用text = text.replace(/(\r\n|\r|\n)+/g, '$1');但是没有间距就摆脱了所有新行.
text = text.replace(/(\r\n|\r|\n)+/g, '$1');
javascript regex jquery
javascript ×1
jquery ×1
regex ×1