javascript - The newline character is not read as \r\n, but directly as \n\n? ?
淡淡烟草味
淡淡烟草味 2017-05-19 10:19:36
0
3
762

The data returned in the background is this,

I do not display line breaks on the page, but directly change lines in the html. The point is, I want to use the regular replace:
to find that the newline character is not replaced with /r/n, but \n\n
,

Maybe there is something wrong with my question. In fact, my code is
'a= "Change a new line

Change 2 lines

Hahaha

The above is 3 lines "',
That is, a = 'Change one line nn change 2 lines nnn hahaha nnnn The above is 3 lines',
2 'nn' is a newline character, followed by 1' /n', just change one more line,
I need to use regular expressions to correctly replace these with '
'

Is there any way to solve it? Urgent, urgent, rest,

淡淡烟草味
淡淡烟草味

reply all(3)
迷茫

过去多啦不再A梦

Although you added a description, I still don’t quite understand your problem.

replace(/[rn]+/, 'n')

迷茫

Zero-width assertion:

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template