Mario
Mario

Reputation: 1488

Remove lines that is shorter than 5 characters before the @ using Notepad++

Maybe the title is 99% not understandable

I have like that:

abc@5004428
abcd@62604
abcde@505779

But my file is larger than that.

So, I want to remove the whole line that contain "abc" and "abcd" becase they are before @ and they are shorter than 5 or not equal characters.

More explained: I want to remove the whole line which value before @ is shorter than or EQUAL to 5 characters.

Any help would be appreciated.

Thanks!

Upvotes: 4

Views: 2514

Answers (2)

Daria Pydorenko
Daria Pydorenko

Reputation: 1802

You can use regex like this: ^(.{0,4}@.*)$ to select lines and then remove them with Notepad++.

^ - a start of the line

.{0,5} - checks if value before @ is shorter than or equal to 5 characters.

NOTE: .{0,4} will check if value before @ is shorter than 5 characters (not equal to 5 characters).

.* - all other symbols after @.

$ - an end of the line

Upvotes: 5

John Doe
John Doe

Reputation: 76

Set 'Search Mode' to regular expression, and use the following phrase:

^\w{1,5}@.+

works like this:

^- : start of line

\w{1,5} : 1 to 5 word charachters long

@ : matches 'At sign' literally

.+ : remainder of line

and replace with empty line. To replace empty lines set search mode to extended and replace double line ends with single line ends.

Upvotes: 1

Related Questions