Remove text based on pattern

Advanced Renamer forum
#1 : 05/08-19 20:28
Joao Roldi
Joao Roldi
Posts: 1
Hello there!

I'm in need to remove some texts based on a pattern. I didn't find an answer that matches what I need to do. So, I'm asking here

I have a bunch of files that have a pattern like this:

SOLD - US - 01.JAN - JOHN SMITH - 01TJLCA - YUHMCH
SOLD - DE - 02.FEB - ANGELA STRAUSS - 88HCNANLASKC
BGHT - MX - 04.APR - HERNANDES FERNANDES - K55
BGHT - SA - 06.JUN - SHEIK ALIBABA - 10000000KBMJ_JCA

I want to remove everything after the name, but due to the lack of pattern in the number of characters, I'm having a bit of trouble doing that.

Can someone help me? Please!


05/08-19 20:28 - edited 05/08-19 20:40
#2 : 05/08-19 22:24
David Lee
David Lee
Posts: 1125
I'm sure that a more elegant solution should be possible but the following should work...

Remove Pattern: ([^-]*-){3}( \w*){2}\K.*
Using Regular expressions


05/08-19 22:24
#3 : 06/08-19 11:55
David Lee
David Lee
Posts: 1125
Reply to #2:
([^-]*-){3} .*?\K-.* will cope with spaces in the name field (ie more than two forenames).

The meta-character \K is an instruction not to save the preceding match (not included in the summary in the user guide).


06/08-19 11:55 - edited 06/08-19 19:40