Extract columns with notepad ++
-
I have searched several websites, a solution in notepad but does not work, the previous solution of (? -s) ^. + ?: (. + ?:) (. + ?:) {2} (. +?) (: . *)? (? = \ R | \ z), it didn’t work, I’m not a specialist, I’m learning recently, can you help me?
My text is like this:brian:Ryan@me.com:happy:2345:634fcc0a1193258a10867f671612386f:varchar(100)
michael:Kimberley@me.com:096cd42539bc9d5dae70eb76275052e0:PRIMARY_KEY
jason:Osian@yahoo.com:date:096cd42539bc9d5dae70eb76275052e0:and I need the following result
Ryan@me.com:2345:634fcc0a1193258a10867f671612386f
Kimberley@me.com:096cd42539bc9d5dae70eb76275052e0
Osian@yahoo.com:096cd42539bc9d5dae70eb76275052e0 -
Hello, @frank-kis,
(? -s) ^. + ?: (. + ?:) (. + ?:) {2} (. +?) (: . *)? (? = \ R | \ z)
Quite weird ! As I immediately recognized the regex I gave in @toti-chalo’s post, some hours ago ! Are you the same person ?
https://community.notepad-plus-plus.org/post/49469
In that post, it is said
this is my example, but I always need the second and fifth column
Now, considering your very short present example, I tried to find out a general rule to build a correct regex, without any result :-((
If we suppose that we have a colon-delimited file, seemingly, you need, after replacement :
-
To get rid of the first field
-
To get rid of all fields after the
MD5
field, with their32
hexadecimal digits -
To keep the second field
If we assume these first conditions, your text becomes :
Ryan@me.com:happy:2345:634fcc0a1193258a10867f671612386f Kimberley@me.com:096cd42539bc9d5dae70eb76275052e0 Osian@yahoo.com:date:096cd42539bc9d5dae70eb76275052e0
But, which additional rule must I apply to get the text, below, what you expect to ?
Ryan@me.com:2345:634fcc0a1193258a10867f671612386f Kimberley@me.com:096cd42539bc9d5dae70eb76275052e0 Osian@yahoo.com:096cd42539bc9d5dae70eb76275052e0
Could you, please, give us some more lines of text to study ?
See you later,
Best Regards
guy038
-
-
@guy038
the text isjason:Osian @ yahoo. com:date:096cd42539bc9d5dae70eb76275052e0:
1:sull @ insanelyi. com:1265737895:…:4:c806318233764c2da90b4930b0c6a591:'-9}
brian:Ryan @ me. com:happy:2345:634fcc0a1193258a10867f671612386f:varchar(100)
michael:berley @ me.com:096cd42539bc9d5dae70eb76275052e0:PRIMARY_KEY
3:mars @ hotmail. com:1265768566:3:470df90857bf8d00e0c157d88468f743:A2R3v
4:alex.s @ me. com:1265769583:Member:3:62d43f2f05ec755023b2ee1f371610d5:3f7;
77:carters @ hotmail. com:1265772833:Pira:14:b9a4d56584e3a72c8a5a2018d2d5b6a9:–rI3
56:hayden @ hotmail. com:1265778966:AppleAddict:14:17c185b1bdd907c9acf65ab8416b47e3:j^D5bto
Osian @ yahoo. com:096cd42539bc9d5dae70eb76275052e0:
sull @ insanelyi. comc806318233764c2da90b4930b0c6a591
Ryan @ me. com:happy634fcc0a1193258a10867f671612386f
berley @ me.com:096cd42539bc9d5dae70eb76275052e0
mars @ hotmail. com:470df90857bf8d00e0c157d88468f743
alex.s @ me. com 62d43f2f05ec755023b2ee1f371610d5
carters @ hotmail. com b9a4d56584e3a72c8a5a2018d2d5b6a9
hayden @ hotmail. com:17c185b1bdd907c9acf65ab8416b47e3 -
excuse me, the emails are together, I put them apart because they didn’t allow me to reply,
mail: hash
thanks -
Hi, @frank-kis, and All,
Personally, I did receive the input and output text in the same post !
Regarding the text you’re expecting, after replacement, sorry, but I’m still confused !
-
Why the
2nd
,6th
and7th
lines do not contain any colon ?-
In the
2nd
line, the colon, before theMD5
zone, is simply deleted -
In the
6th
line, the colon, before theMD5
zone, is replaced with a space char -
In the
7th
line, the colon, before theMD5
zone, is replaced with a space char
-
To my mind, if we add these missing colon
:
characters, the expected text would be more coherent :Osian @ yahoo. com:096cd42539bc9d5dae70eb76275052e0: sull @ insanelyi. com:c806318233764c2da90b4930b0c6a591 Ryan @ me. com:happy634fcc0a1193258a10867f671612386f berley @ me.com:096cd42539bc9d5dae70eb76275052e0 mars @ hotmail. com:470df90857bf8d00e0c157d88468f743 alex.s @ me. com:62d43f2f05ec755023b2ee1f371610d5 carters @ hotmail. com:b9a4d56584e3a72c8a5a2018d2d5b6a9 hayden @ hotmail. com:17c185b1bdd907c9acf65ab8416b47e3
However, there’s still a problem. In the
3rd
line, you want to keep the stringhappy
. That is not logical, regarding all the other lines !?So, can you shed some light on these points… Thanks !
Once we’ll get a coherent output text, build the appropriate regex, to move from input text to output text, is rather easy ;-))
BR
guy038
-
-
Ok my friend, I just wanted the email and the hash
2:alex.grig2@me.com:1283313747:2e0d7e0fcd9576ca19b17741c2ebc1bb:?G-N:ip
29:vs1ck@me.com:1283315003:e339e33ef20d66617d7d15418bd6526d:^v+[a:host
292:firspiderman@me.com:1283315546:9e6752c212d376b4293c40cfc0b3cbc5:+;kH
29:anthonym24@yahoo.com:1283316357:15710b20a3d5721c72ac036f5c5a84dd:tiNDi
222:ancientus@yahoo.com:1283317401:8cdc44024ee3bd4a73b2d01a49bfc8fe:0|7Eb
923:exp1iitc0nt3nt@me.com:1283318508:14:3498a32f4b749715570ad476604de347:.=@UK
24:alexobritsch@yahoo.com:1283318682:506c25f62848b25b256790b6855a57e8:oP&BG
29:akag205@yahoo.com:1283319044:9bf0cdb097138f8cab09a1d5264d9581:K&Gw+:89
296:miel1329@me.com:1283326032:3864f64adcd4525a4cdeb9bacb01562f:VbU84
27:lovk27@me.com:1283328454:2015214ea772a41d35e1d95a19af99f2:y16Oy
1928:jshver05@yahoo.com:1283330308:5236800df4ec5a3618f099ebbde1bd02:{x}l9
3929:beedy@yahoo.com:1283333359:117ab3567f6c4e41465ca3fb62fa8539:iB,)]
493:shihi@yahoo.com:1283333632:f7ccc1bb6ed6e2cbca6b59712754fdfb:NIZkC
293:yazaq@me.com:1283351855:ed92b485f1b9538de2fadb10ef2bb364:>U#m$
2942:lavarrell@me.com:1283352547:a47bd0cca19731fb8e8b520f7785726c:@^@$&
23:mm34@yahoo.com:1283377639:f049c0a3bf8ee64aae6f09c98bf5f3e0:]A%]}:dominio
293:mr_grumpy209@me.com:1283388146:29e253a3c746a51b80e3a4e08d18defb:G/V$| -
Hi, @frank-kis, and All,
Apparently, you just gave me the input text without saying which text you expect to ! As you do not seem to make some efforts, on your own, to solve your problem, quickly, my reply will be the last one. Sorry ! I’m giving you a solution based upon my guess of what you need. Good luck for adapting my regex solution to your real needs !
So, assuming your last input text, below, opened in a Notepad++ tab :
2:alex.grig2@me.com:1283313747:2e0d7e0fcd9576ca19b17741c2ebc1bb:?G-N:ip 29:vs1ck@me.com:1283315003:e339e33ef20d66617d7d15418bd6526d:^v+[a:host 292:firspiderman@me.com:1283315546:9e6752c212d376b4293c40cfc0b3cbc5:+;kH 29:anthonym24@yahoo.com:1283316357:15710b20a3d5721c72ac036f5c5a84dd:tiNDi 222:ancientus@yahoo.com:1283317401:8cdc44024ee3bd4a73b2d01a49bfc8fe:0|7Eb 923:exp1iitc0nt3nt@me.com:1283318508:14:3498a32f4b749715570ad476604de347:.=@UK 24:alexobritsch@yahoo.com:1283318682:506c25f62848b25b256790b6855a57e8:oP&BG 29:akag205@yahoo.com:1283319044:9bf0cdb097138f8cab09a1d5264d9581:K&Gw+:89 296:miel1329@me.com:1283326032:3864f64adcd4525a4cdeb9bacb01562f:VbU84 27:lovk27@me.com:1283328454:2015214ea772a41d35e1d95a19af99f2:y16Oy 1928:jshver05@yahoo.com:1283330308:5236800df4ec5a3618f099ebbde1bd02:{x}l9 3929:beedy@yahoo.com:1283333359:117ab3567f6c4e41465ca3fb62fa8539:iB,)] 493:shihi@yahoo.com:1283333632:f7ccc1bb6ed6e2cbca6b59712754fdfb:NIZkC 293:yazaq@me.com:1283351855:ed92b485f1b9538de2fadb10ef2bb364:>U#m$ 2942:lavarrell@me.com:1283352547:a47bd0cca19731fb8e8b520f7785726c:@^@$& 23:mm34@yahoo.com:1283377639:f049c0a3bf8ee64aae6f09c98bf5f3e0:]A%]}:dominio 293:mr_grumpy209@me.com:1283388146:29e253a3c746a51b80e3a4e08d18defb:G/V$|
-
Open the Replace dialoag (
Ctrl + H
) -
SEARCH
(?-s)^.+?:(.+?:).*([[:xdigit:]]{32}).+
-
REPLACE
\1\2
-
Tick the
Wrap around
option -
Select the
Regular expression
search mode -
Click once on the
Replace All
button
You should get, immediately, the text :
alex.grig2@me.com:2e0d7e0fcd9576ca19b17741c2ebc1bb vs1ck@me.com:e339e33ef20d66617d7d15418bd6526d firspiderman@me.com:9e6752c212d376b4293c40cfc0b3cbc5 anthonym24@yahoo.com:15710b20a3d5721c72ac036f5c5a84dd ancientus@yahoo.com:8cdc44024ee3bd4a73b2d01a49bfc8fe exp1iitc0nt3nt@me.com:3498a32f4b749715570ad476604de347 alexobritsch@yahoo.com:506c25f62848b25b256790b6855a57e8 akag205@yahoo.com:9bf0cdb097138f8cab09a1d5264d9581 miel1329@me.com:3864f64adcd4525a4cdeb9bacb01562f lovk27@me.com:2015214ea772a41d35e1d95a19af99f2 jshver05@yahoo.com:5236800df4ec5a3618f099ebbde1bd02 beedy@yahoo.com:117ab3567f6c4e41465ca3fb62fa8539 shihi@yahoo.com:f7ccc1bb6ed6e2cbca6b59712754fdfb yazaq@me.com:ed92b485f1b9538de2fadb10ef2bb364 lavarrell@me.com:a47bd0cca19731fb8e8b520f7785726c mm34@yahoo.com:f049c0a3bf8ee64aae6f09c98bf5f3e0 mr_grumpy209@me.com:29e253a3c746a51b80e3a4e08d18defb
BR
guy038
-
-
I’m sorry for my English, I’m from Chile, I thank you very much for your help, for you what I needed was solved
You are a great person and teacher in notepad.
regards
Happy new year 2020