Page 1 of 1

Expression - Swapping Positions

Posted: 2020-12-24 06:52:03
by phatlix
Hello,

I am curious if Ant Renamer is capable of performing a bit more intricate regex, and if so, could I get a hand figuring my issue out.

I have a metric boat load of karaoke music. The music is all in zip archives. I am trying to format all the music the same, and Ant Renamer has been a huge help! But now I am wanting more. ;)

I am formatting each song as follows...

DISCID-TRACK - ARTIST - TITLE.ext

I have numerous songs named for example...

EXAMPLE1: SC0000-00 - BRAXTON, TONI - I DONT WANT TO.zip
EXAMPLE2: SC0000-00 - INGRAM, JAMES AND TESH, JOHN - GIVE ME FOREVER.zip
EXAMPLE3: SC0000-00 - BEATLES, THE - TWIST AND SHOUT.zip
EXAMPLE4: SC0000-00 - LAST, FIRST AND BIG BAND, THE - SONG TITLE.zip

I would like to swap the artist names back to FIRST LAST and drop the comma's. But I would also like to NOT switch the songs that are "BAND, THE" (EXAMPLE3).

For EXMAPLE1 I am able to accomplish this with,

EXPRESSION:

Code: Select all

(.*) - (.*), (.*) - (.*)
NEW NAME:

Code: Select all

$1 - $3 $2 - $4
However, this also changes EXAMPLE3 and that's not what I want.

For EXAMPLE2 the following works,

EXPRESSION:

Code: Select all

(.*) - (.*), (.*) (AND) (.*), (.*) - (.*)
NEW NAME:

Code: Select all

$1 - $3 $2 $4 $6 $5 - $7
However, this also does not take the ", THE" into account (EXAMPLE4).

Is it possible to build a expression that would handle these scenarios, or even a couple separate expressions that I could run? Like I mentioned at the beginning, I'm dealing with a lot of files (over 100k). If I mess this up on a big swath of them, I may never see it until I run crossed it later down the road.

I would appreciate any help! Thank you!

Re: Expression - Swapping Positions

Posted: 2020-12-25 19:27:32
by antp
Hi,
Normally using something like this to exclude "THE" should work:

Code: Select all

(.*) - (.*), (?!THE)(.*) - (.*)
but the engine embedded in Ant Renamer does not support that.
What you could do is to rename it anyway with the others, and after change back all the "THE" artists?

Re: Expression - Swapping Positions

Posted: 2020-12-26 18:57:34
by phatlix
Thank you.