Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I delete specific lines in Notepad++?

Tags:

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?

like image 866
Rismo Avatar asked May 27 '09 21:05

Rismo


People also ask

How do I delete a specific line?

Delete lines or connectors Click the line, connector, or shape that you want to delete, and then press Delete. Tip: If you want to delete multiple lines or connectors, select the first line, press and hold Ctrl while you select the other lines, and then press Delete.

How do you remove words from notepad?

Replacing text within Notepad Microsoft Notepad is included with all versions of Windows and can replace text in plain text files. To replace text in Notepad, follow the steps below. Open the text file in Notepad. Click Edit on the menu bar, then select Replace in the Edit menu.


2 Answers

Notepad++ v6.5

  1. Search menu -> Find... -> Mark tab -> Find what: your search text, check Bookmark Line, then Mark All. This will bookmark all the lines with the search term, you'll see the blue circles in the margin.

  2. Then Search menu -> Bookmark -> Remove Bookmarked Lines. This will delete all the bookmarked lines.

You can also use a regex to search. This method won't result in a blank line like John's and will actually delete the line.

Older Versions

  1. Search menu -> Find... -> Find what: your search text, check Bookmark Line and click Find All.
  2. Then Search -> Bookmark -> Remove Bookmarked Lines
like image 114
Ray Avatar answered Nov 02 '22 06:11

Ray


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.

like image 28
John T Avatar answered Nov 02 '22 08:11

John T