Expression - Swapping Positions

If you need help on how to use the program
Post Reply
phatlix
Posts: 2
Joined: 2020-12-24 05:51:30

Expression - Swapping Positions

Post 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!
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Expression - Swapping Positions

Post 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?
phatlix
Posts: 2
Joined: 2020-12-24 05:51:30

Re: Expression - Swapping Positions

Post by phatlix »

Thank you.
Post Reply