What is a cross platform regex for removal of line breaks?

后端 未结 5 1910
囚心锁ツ
囚心锁ツ 2020-12-08 04:36

I am sure this has been asked before, but I cannot find it.

Basically, assuming you are parsing a text file of unknown origin and want to replace line breaks with so

5条回答
  •  遥遥无期
    2020-12-08 05:29

    Just replace /[\r\n]+/g with an empty string "".

    It'll replace all \r and \n no matter what order they appear in the string.

提交回复
热议问题