selecting a range of files

Advanced Renamer forum
#1 : 25/11-20 11:33
mike
mike
Posts: 19
hi guys,

I have a bunch of files <name>__999.jpg , where 999 represents numbers from 001 to 999.
I want to select only first 50 files for renaming.

How can I select them using "add the files in the folder" and further "regular expression match" options?

What should be the syntax there?

TIA


25/11-20 11:33 - edited 25/11-20 11:34
#2 : 25/11-20 14:54
David Lee
David Lee
Posts: 1125
.*0([0-4][0-9]|50)\.jpg


25/11-20 14:54
#3 : 26/11-20 10:55
mike
mike
Posts: 19
Reply to #2:
thanks. Need a while to understand this :-)


26/11-20 10:55
#4 : 26/11-20 16:15
David Lee
David Lee
Posts: 1125
Reply to #3:
When adding files you have to match the entire filename - including the extension ".*0([0-4][0-9]|50)\.jpg"

[...] will match any single character from the enclosed list "..."
This can be a simple list of individual characters eg [abcdxyz]
or can include a range of characters (in order of ASCII code) eg [a-dxyz]

So .*0[0-4][0-9]\.jpg will match any filename with number in the range 000 to 049:
".*" matches any number (including zero) of any characters
"0" matches the digit zero
[0-4] matches the second digit if in the range 0 to 4
[0-9] matches any third digit (ie 0 to 9]
\.jpg matches the extension (note that "." stands for "any character" in regex - in order to represent itself you must use the "escape" character ie "\.")

We also want to match "050", which we could do using ".*050\.jpg

The two can be combined using the "OR" operator "|" as .*0([0-4][0-9]|50).jpg

For a basic intro to regex see www.advancedrenamer.com/user_guide/regular_expresion
This only describes a limited subset of options - for more detailed information the Internet will be your friend (when searching, note that ARen uses the PCRE flavour of regex).

Hope that's helpful.





26/11-20 16:15 - edited 26/11-20 16:18
#5 : 26/11-20 22:32
mike
mike
Posts: 19
Reply to #4:
much appreciated David.

I do understand the basics of regex, and after a while I got the point. Nevertheless reading regex is somehow different than "writing", so your exp. is more than welcome.


26/11-20 22:32