Using Special Characters In Formulas

Advanced Renamer forum
#1 : 16/08-14 16:38
David
David
Posts: 64
I am trying to use a formula that renames files based in part on characters which seem to be illegal to use.

The names are in the format

002 Fear Itself - The Fearless 001 (Of 12) (2011)
003 Fear Itself - The Fearless 002 (Of 12) (2011)

So what I want to be able to do is make the second number only 2 digits and the third number also 2 digits so the new filename will be

002 Fear Itself - The Fearless 01 (Of 12) (2011)
003 Fear Itself - The Fearless 02 (Of 12) (2011)

I can do it by removing the brackets first
and then using this " 0(\d{2}) of (\d{2})"
And this " \1 (Of \2)"

The problem is I have about 75 other methods prior to this and I am renaming thousands of files at a time and many of the filenames have brackets around characters that are not numerical digits and I don't know how to put the brackets back on everything that they were previously on. So what I need to be able to do is use the opening bracket in the formula. This would also be useful to me in many other instances I have come across.

Is there a way I can shelter it so AR will let it be used in the formula.


16/08-14 16:38 - edited 23/09-16 14:46
#2 : 16/08-14 20:05
Stefan
Stefan
Posts: 274
Reply to #1:
 

If you would want to match brackets, you could just escape them in your regex pattern:
(.+\w )(\d)(\d\d \(Of \d\d\)\(\d{4}\))



But... No need to removing the brackets first.

FROM:
002 Fear Itself - The Fearless 001 (Of 12) (2011).ext
003 Fear Itself - The Fearless 002 (Of 12) (2011).ext

TO:
002 Fear Itself - The Fearless 01 (Of 12) (2011).ext
003 Fear Itself - The Fearless 02 (Of 12) (2011).ext

RULE:
Remove first digit of the second three-digits group.
Or better
Remove first digit of a three-digits group behind a char-space combo.


USE:
Replace method (http://www.advancedrenamer.com/user_guide/metho d_replace)

Use RegEx to match
(one-or-more of an signs till a char followed by a space) + (one digit) + (two digits and the rest till end)


Find: ^(.+?\w )\d(\d\d.+)$
Repl: \1\2
[X] RegEx
Apply to: Name




Done!


16/08-14 20:05 - edited 16/08-14 20:10
#3 : 20/08-14 02:11
David
David
Posts: 64
Reply to #2:
Thanks for the help Stefan.


20/08-14 02:11 - edited 20/08-14 02:31