#1 : 10/02-23 13:24
I try to add color codes to lots of files following this:
ORIGINAL FILE NAMES:
When I use replace list, I get files like "123-222334-night-117-blue-34.jpg", I didn't find the right method yet. I hope somebody can help me!
#2 : 10/02-23 16:14
Simple! Only add a colour code if "-<colour->" is both preceded and followed by numerical digits.
List Replace using regular expressions...
Replace: \d\K(-blue-)(?=\d) with: -117\1
(=?\d) is a "lookahead", which is an instruction to match the preceding pattern only if it is followed by a digit (\d).
Unfortunately the corresponding "lookbehind" (?<=\d) is not available in the regex flavour used by Advanced Renamer (PCRE) so we have to use a workaround:
"\d(-blue-)" will match a digit followed by "-blue-" and the character "\K" is an instruction to exclude any preceding matched characters from the final result.
Placing a pattern in parentheses ie (-blue-) means that any resulting match will be saved in a numbered variable (\1 in this case) , which can be recalled in the replacement string.
#3 : 13/02-23 12:09
Reply to #2:
Thank you very much!!
I'm new to Advanced Renamer and didn't know all the characters yet.
The list replace worked now!