Rename by removing a substring with placeholders computed from the end

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Rename by removing a substring with placeholders computed from the end

Post by *BlackWinny »

Hi everybody,

In the help I try to find the placeholders for this situation :

:arrow: The original filenames (these are the first three... I have actually 3000 to rename):

Hors-série avec Didier Sicard (22-12-2020)_Arte_2020_12_22_20_07.txt
Nos cerveaux menacés - Peut-on faire renaître le désir d'Europe (05-03-2019)_Arte_2019_03_05_20_05.txt
Rodolphe Burger - Moraliser la vie politique (29-07-2020)_Arte_2020_07_29_20_07.txt


:arrow: The filenames I want to get:

Hors-série avec Didier Sicard_Arte_2020_12_22_20_07.txt
Nos cerveaux menacés - Peut-on faire renaître le désir d'Europe_Arte_2019_03_05_20_05.txt
Rodolphe Burger - Moraliser la vie politique_Arte_2020_07_29_20_07.txt


It means that the substring to remove is always at the same place from the end, and always with the same length. But as you can see the strings can have very different lengths.

For the moment, the only solution I have found in the help to get the final strings is this:
[N-500-36][N-22-]
where the number 500 is here only to tell "downward to the beginning", knowing that none original filenames won't ever reach 500 characters.

:?: My request to you: I try to find a combination to avoid this "500".
:)

It seems that there is no other solution out of this one that I have found above. Could you confirm?


Thanks a lot!
Jacques
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Re: Rename by removing a substring with placeholders computed from the end

Post by *HolgerK »

BlackWinny wrote: 2022-11-27, 21:03 UTC It seems that there is no other solution out of this one that I have found above. Could you confirm?
Not confirmed.

[N1--36][N-22-]

or (notice the space in front of the opening round bracket)
Search for: (??-??-????)
Replace with: <Clear>

or with regex checked
Search for:\W\(\d\d-\d\d-\d\d\d\d\)

or (also with regex checked)
Search for:\s\(\d\d-\d\d-\d\d\d\d\)

or (again with regex checked)
Search for:\s\(\d{2}-\d{2}-\d{4}\)

HTH
Holger
Make our planet great again
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Rename by removing a substring with placeholders computed from the end

Post by *BlackWinny »

GREAT !

If I understand correctly,
1. the first solution works whatever the substring (I just have to adjust the specified coordinates).
2. all the other solutions (even the first one not using regex) are based on a mask, a pattern, using a format framed by round brackets (because in my case it is round brackets which start and stop the pattern).

Did I understand correctly?
:D
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Re: Rename by removing a substring with placeholders computed from the end

Post by *HolgerK »

Exactly.

Regards
Holger
Make our planet great again
User avatar
BlackWinny
Junior Member
Junior Member
Posts: 45
Joined: 2014-01-18, 16:10 UTC
Location: Close to Paris, France

Re: Rename by removing a substring with placeholders computed from the end

Post by *BlackWinny »

Thanks a lot, Holger!

Great help!

Best regards!
Jacques
Post Reply