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
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.