Remove lines that meet a requirement using notepad ++
-
friends it is possible to eliminate those lines that are not complete with your correspondent email, I have the lines
dozyyqprodus@mybuy.com:dory34
dozen12@yahoo.com:crhis
46trgfbf7:dank420
dp.b2c33:@phill
terry.hj:6@YD9
146000@gmail.com:bell2
2435678eb:~lH@m]
fjui34:t@,the result would be:
dozyyqprodus@mybuy.com:dory34
dozen12@yahoo.com:crhis
146000@gmail.com:bell2my text is very big
thanks you -
What have you tried? Have you used one of the regular expression helper sites to try to build a correct regular expression to match your data?
-
@Scott-Sumner said:
What have you tried? Have you used one of the regular expression helper sites to try to build a correct regular expression to match your data?
thanks, friend I need to delete those that do not have full email, I tried with regular expression but it did not work,
-
Hello, @ani-rodet, scott-sumner and All,
Ah, OK, I won’t abandon you, with your big text ;-))
So, open the Replace dialog (
Ctrl + H)SEARCH
(?-si)^.+@[a-z]+\.(com|org|net|int|edu|gov|mil)(:\w+)?\R|^.+\RREPLACE
?1$0-
Select the
Regular expressionsearch mode -
Tick the
Wrap aroundoption -
Click on the
Replace Allbutton
Et voilà !
Notes :
- I took the main top-level-domains from this link :
https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
- For instance, here are below, the different parts of the regex, with, accordingly, the first line
dozyyqprodus@mybuy.com:dory34
(?-si)^ .+ @ [a-z]+ \. (com|org|net|int|edu|gov|mil) (: \w+ )? \R | ^.+ \R >dozyyqprodus @ mybuy . com : dory34 CRLF or ALL line contents CRLF-
Just try to guess how this regex works and, please, read some regex documentation ;-) Indeed, that regex is simply made up of basic consecutive structures and it’s not very difficult to build !
-
Regarding the Replacement part,
-
If group
1exists,(com|org|net|int|edu|gov|mil), all the matched string is re-written -
If not, the entire line, with its line-break, is deleted
-
Best Regards,
guy038
-
-
great friend, thank you very much for your help, I’m learning every day,
If you work, thank you, I do not know how to thank you
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login