Notepad++ regex -> newLine

前端 未结 5 1756
孤街浪徒
孤街浪徒 2021-01-06 03:02

I use Notepad++ and I need to delete all lines starting with, say \"abc\".

Attention, I don\'t need to replace the line starting with \"abc\" with a empty line, but

5条回答
  •  轮回少年
    2021-01-06 03:29

    Press Ctrl+H to bring up the Replace window. Put

    ^abc.*(\r?\n)?
    

    in the Find what and leave Replace with empty. Select Reqular expression and hit Replace All.

    This reqular expression handles all the edge cases:

    • When the first line of the file starts with abc
    • When the last line of the file starts with abc and there is no new line at the end of the file.

提交回复
热议问题