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|^.+\R
REPLACE
?1$0
-
Select the
Regular expression
search mode -
Tick the
Wrap around
option -
Click on the
Replace All
button
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
1
exists,(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