Texh
Texh

Reputation: 1973

How to remove lines which contain certain word/charater twice in notepad+

i want to know if we can remove all the lines in notepad+ that contain specfic letter or word twice in one single line.

for my problem i have a big text file and i want to remove all lines that contain email address twice.. thou the email ID is not the same but i simply just dont want that line, so i thou i can remove all notepad lines that contain @ sign twice... but unforunatly i dont know how to do that. so can anyone please tell me with the regex of this process and if there are any better alternatives please also mention that

thanks

Upvotes: 0

Views: 368

Answers (2)

danish
danish

Reputation: 359

A generic solution could be replacing

.*(.).*(\1).*

with \n

Upvotes: 0

Avinash Raj
Avinash Raj

Reputation: 174706

The below regex would match all the lines which has two @ symbols. Just replace the matched strings with an empty string will delete that corresponding line.

^.*?@.*?@.*\n?

DEMO

Upvotes: 2

Related Questions