#1 : 27/02-22 22:42 Alexander Kirchner
Posts: 2
|
I need to rename ~7k files to according to a new pattern
The old Pattern is: A String of Words vXX.extension, where A String of Words can be anything from 5 alphanumerical characters to 100 alphanumerical characters and vXX is, i.e., v01. There can be multiple files in a folder, but the vXX is not neccessarily increasing by +1, it can skip some numbers and continue at i.e., v01 -> v02 -> v05 … The new pattern should be: A String of Words vXX #XX, where vXX and #XX are the same I have no Idea how I could do this, maybe with a regex, but I don't really know how to use them, so any help is appreciated. Thanks in advance. |
#2 : 27/02-22 23:05 David Lee
Posts: 1125
|
I'm not entirely sure that I understand what you want to do.
However if you want to preserve the existing extension then try... Replace: ".*v(\d{2})\K" with: " #\1" Use regular expressions Apply to: Name or if you want to remove the extension... Replace: ".*v(\d{2})\K.*" with: " #\1" Use regular expressions Apply to: Name and extension. Quotes are for clarity - do not include in the method. |
#3 : 28/02-22 18:09 Alexander Kirchner
Posts: 2
|
Reply to #2:
Thanks!! The first regex did exactly what I needed it to do ^^ I should definitively invest some time learning how to use regex... They appear to be very useful |
#4 : 28/02-22 19:10 David Lee
Posts: 1125
|
Reply to #3:
The user Guide is a good start: https://www.advancedrenamer.com/user_guide/regul ar_expresions However the list of metacharacters is very basic and you will need to use Google to solve more complicated problems. An excellent resource is https://www.regular-expressions.info/ For example you won't find \K in the User Guide - this is a very useful metacharacter that is an instruction to omit all the previously matched characters from the final match. You also need to be aware that there are several different implementation of regex and not all options are available in any given flavour. Advancer Renamer uses "Perl Compatible Regular Expressions" (PCRE). |
#5 : 28/02-22 19:58 Joel de Bruijn
Posts: 26
|
Reply to #4:
Can recommend RegExr also, to play and test. https://regexr.com/ Many times I just copy/pasted filenames as text and 'coded' some RegEx to see what it does. |