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,
过去多啦不再A梦2017-05-19 10:21:36
Although you added a description, I still don’t quite understand your problem.
replace(/[rn]+/, 'n')