Notepadguy
Notepadguy

Reputation: 343

Remove all lines without an @ character in Notepad++

I have a list like:

asd@asd
abcdefgh
abcde@fgh
ijklmnop

I want to remove all lines without the symbol @. The result should be:

 asd@asd
 abcde@fgh

Can this be done in Notepad++, and if so, how?

Upvotes: 7

Views: 15740

Answers (3)

stema
stema

Reputation: 93046

In the search window, goto the "Mark" tab (If it is missing, you need to upgrade your Notepad++).

Select "Bookmark Line" and "Regular Expression", use the regular expression you already got

^[^@]*$

Press "Mark all"

This results in bookmarks for all Lines with no @.

Goto the menu point "Search - Bookmark -> "Remove Bookmarked Lines"".

Upvotes: 1

Ryan Gross
Ryan Gross

Reputation: 6515

Use find and replace with the following regular expression:

^[^@]*$

Upvotes: 2

obaqueiro
obaqueiro

Reputation: 982

Try looking for:

^[^@]*$

and replacing with an empty string.

Upvotes: 23

Related Questions