multi-rename tool: rename literal [square brackets] in file?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
dindog
Senior Member
Senior Member
Posts: 316
Joined: 2010-10-18, 07:41 UTC

multi-rename tool: rename literal [square brackets] in file?

Post by *dindog »

I want to rename this files:
[POPGO][Macross Frontier][01][720P][BluRay][x264_AC3][9AD5C4CE]_Track3.ass
[POPGO][Macross Frontier][02][720P][BluRay][x264_AC3][923FA857]_Track3.ass
[POPGO][Macross Frontier][03][720P][BluRay][x264_AC3][14E6A7DE]_Track3.ass
[POPGO][Macross Frontier][04][720P][BluRay][x264_AC3x2][7E4E1D7D]_Track4.ass
To
[a][01][c].ass
[a][02][c].ass
[a][03][c].ass

These files are subtitles for a drama, [a][c] is to fit the videos' file name that allow the player loading the corresponding subtitle automatically. (Very very common naming strategy)

Suggestion:
I tried rename them directly at first, but TC rename tools take single "[" "]" as an expression, so I had to make it like [[][C][]] to finish "[ORDER]", very difficult to read and modify :cry:

Maybe TC could choose an unaccepted character instead of the current "[]" would solve that, like "<>"
[a][<C>][c].ass

Help:
Anyway, I try regex expression like:
.*([[0-9][0-9]]).*
[a]\1[c].ass
which ([[0-9][0-9]]) suppose to capture "[order]", but obvious failed.
how can I call that captured group?
Last edited by dindog on 2014-03-22, 15:45 UTC, edited 1 time in total.
User avatar
Ovg
Power Member
Power Member
Posts: 755
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

try escape symbols [ ] which belongs to file name, not to regexp with \ :

(\[[0-9][0-9]\])
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Yes, it is hard to read/write templates with many brackets... But I doubt that someone will change format.

You can read TC help topic concerning regular expression syntax, you need $1 for first captured group etc, also special characters must be escaped as Ovg said.

Try name template [N]$[C] and regex replace \[[0-9a-f]+\](_Track[0-9]+)\$([0-9]+)$ with \[$2\]$1 (uncheck all options except RegEx).

Or if you only need to get counter, it is easy to put it in front of a name using [C:2]$[N] template and replace ([0-9]+)$(.*)$ with \[a\]\[b\]$1\[c\].

Or even simpler, if you type a, b and c manually (do not take them from old names), you can simply use name template [C:2] and regex replace (.*) with \[a\]\[b\]$1\[c\]!
User avatar
dindog
Senior Member
Senior Member
Posts: 316
Joined: 2010-10-18, 07:41 UTC

Post by *dindog »

MVV wrote:Yes, it is hard to read/write templates with many brackets... But I doubt that someone will change format.

You can read TC help topic concerning regular expression syntax, you need $1 for first captured group etc, also special characters must be escaped as Ovg said.

Try name template [N]$[C] and regex replace \[[0-9a-f]+\](_Track[0-9]+)\$([0-9]+)$ with \[$2\]$1 (uncheck all options except RegEx).

Or if you only need to get counter, it is easy to put it in front of a name using [C:2]$[N] template and replace ([0-9]+)$(.*)$ with \[a\]\[b\]$1\[c\].

Or even simpler, if you type a, b and c manually (do not take them from old names), you can simply use name template [C:2] and regex replace (.*) with \[a\]\[b\]$1\[c\]!
Thank you. Solved it. And the same for you Ovg

As for the template format, I think it should post to the suggestion board for further discussion. :D
Post Reply