Search code examples
notepad++

How do I delete specific lines in Notepad++?


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 I can think of several more uses, but is that even possible?


Solution

  • You can use menu Search -> Replace... (Ctrl + H).

    It has a regular expression feature for replacing. You can use a regex that matches #region as well as whatever else is on the line, and replace it with empty space.