How do I delete specific lines in Notepad++?

前端 未结 8 1487
太阳男子
太阳男子 2020-11-28 19:52

I\'m cleaning up some code files (C#) and want to remove the regions. And I would like to delete all the lines that have the string \'#region\'. That\'s just an example, and

8条回答
  •  误落风尘
    2020-11-28 20:30

    Using regex and find&replace, you can delete all the lines containing #region without leaving empty lines. Because for some reason Ray's method didn't work on my machine I searched for (.*#region.*\n)|(\n.*#region.*) and left the replace box empty.

    That regex ensures that the if #region is found on the first line, the ending newline is deleted, and if it is found on the last line the preceding newline is deleted.

    Still, Ray's solution is the better one if it works for you.

提交回复
热议问题