Making a mould of the method of name change

Advanced Renamer forum
#1 : 09/08-24 09:56
Demir VEZIROGLU
Posts: 18
First of all, hello to everyone. As the title suggests, I would like to learn the method and pattern model of the manual changes I made to the file names. For example;

100 - 8A - Umut Timur - Oyna.mp3
Kevin Lyttle - Turn Me On - 106.mp3

with the two files labelled as,

Umut Timur - Oyna.mp3
Kevin Lyttle - Turn Me On.mp3

Is it possible to learn the changes made here as a method and / or pattern?
In other words, I am looking for the method of manual changes I make on each file and ways to use this method in bulk.

Thank you very much in advance for your help. I wish everyone a good day.

edited: 09/08-24 09:59
#2 : 09/08-24 14:34
Delta Foxtrot
Posts: 323
Reply to #1:

Hi Demir,

You just have to break down the files into groups by patterns. For instance, in these two files you have two groups you want to delete at the start in one, but you DON't want to delete the first two groups that are two names in the other. But there's a [space]-[space] in the two groups to delete, so we use that to change the behavior of the program. So to fix all the files that start with [numbers](maybe [letter(s)]) - [numbers](maybe [letter(s)]) we can just do this in a replace method:
Replace: "\d\w* - " (no quotes)
Replace with: [nothing]
Reg. expressions YES

What that does is:
The "\d" is code for a number (\digit); the "\w" means a number, a letter, or an underscore "_", which for some reason are considered to make up "words", hence the \w. The asterisk * after \w modifies it to say that there can be either none, one, or more than one. Then there's a space-dash-space combination, which just literally means look for that after a number and possibly some "word" characters. The " - " between two *actual* words stay in because the word character before them is not preceded by the digit required digit. Regular expressions are "greedy" so it takes away as many of that pattern as it can, unless we do something to stop it.

(There are lots of ways to do the same thing with regular expressions. This "^((\d*)(\w*))*( - )" does exactly the same thing on your filenames).

Next we need another Replace method using regular expressions to remove the " - nnn" at the tail end of the filename. For this use:
Replace: " - \d*$" (no quotes)
Replace with [nothing again]

This uses the literal " - " and the code \d for a digit and the * (zero, one, or many of the digit before it), and adds the $, which says match this only if it's at the end of the filename. And there you have two replace patterns that will fix pretty much any filenames that follow those two patterns.

Here's a link to the user manual section on regular expresssions, study up! :) https://www.advancedrenamer.com/user_guide/regul ar_expresions

Hope this helps!
DF

edited: 09/08-24 14:36
#3 : 09/08-24 16:34
Miguel
Posts: 147
Reply to #2:
Hi Demir and DF.
Sometimes you can use only one Replace method separating differents regexs with the symbol | .

Replace: \d\w* - |\s- \d*$
Replace with: [nothing]

The \s will help to remove the extra spaces generated when delete the last number. This , also can be achieved adding a space before.

Miguel
#4 : 09/08-24 16:53
Delta Foxtrot
Posts: 323
Reply to #3:

Good point, M!

I tend to use the pipe symbol in things like "(tr(ay|igger|avel))" - 'match "tray" OR "trigger" OR "travel" ', for instance, rather than for longer phrases or outside of capturing groups like your usage. Good to be reminded!

That's what I love about ARen... there's almost always several ways to do a thing.

Best,
DF