#1 2024-02-19 19:17

PapyGribouille
Member
Registered: 2024-01-31
Posts: 9

Ajouter des caractères à une chaine

Bonsoir à tous,

   Comment ajouter un ou deux 0 à la 8ème et/ou 9ème place d’une chaine de caractères avec RegEx de ReNamer pour obtenir un nombre de 3 chiffres (dans une liste de 50 milliers de noms) ?
Ex : 201415-12.jpg devient 201415-012.jpg    et   200521-6.jpg devient 200521-006.jpg
Merci
PapyGribouille

Last edited by PapyGribouille (2024-02-20 14:24)

Offline

#2 2024-02-20 18:15

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Ajouter des caractères à une chaine

PapyGribouille via Google Translate wrote:

How to add one or two 0s to the 8th and/or 9th place of a character string with RegEx from ReNamer to obtain a 3-digit number (in a list of 50 thousand names)?

Ex: 201415-12.jpg becomes 201415-012.jpg and 200521-6.jpg becomes 200521-006.jpg

These Regular Expression rules will remove the 8th zero first and then will add enough leading zeros to the second number to make it three digits long.

1) Replace expression "\A(\d{6})-0" with "$1-"
2) Replace expression "\A(\d{6})-(\d{1})\b" with "$1-0$2"
3) Replace expression "\A(\d{6})-(\d{2})\b" with "$1-0$2"

renamer-topic-3005.png

Offline

#3 2024-02-20 18:22

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Ajouter des caractères à une chaine

Note: It is difficult to follow your renaming logic across three separate topics which appear to be related. Perhaps it would be best to start a new thread, outline the full renaming logic and list your input filenames and desired output filenames.

Offline

Board footer

Powered by FluxBB