How do I replace a newline in Atom?

前端 未结 5 1898
滥情空心
滥情空心 2021-01-31 03:07

In Atom, If I activate regex mode on the search-and-replace tool, it can find newlines as \\n, but when I try to replace them, they\'re still there.

Is th

5条回答
  •  鱼传尺愫
    2021-01-31 03:32

    Looks like Atom matches newlines as \r\n but behaves inconsistently when replacing just the \n with nothing.

    So newlines seem to match \s+ and \r\n, and only "half" of the line-ending matches \n.

    • If you replace \n with a string, nothing happens to the line-ending, but the string is appended to the next line
    • If you replace \r with a string, nothing happens at all, but the cursor advances.

提交回复
热议问题