Reversing complex group-artist mp3 naming

A swapping-ground for Regular Expression syntax

Reversing complex group-artist mp3 naming

Postby mrvelous01 » Mon Jun 01, 2009 11:12 pm

Hello. I'm relatively new to regular expressions and have taken a few shots at this, but can't seem to get it right. I have also reviewed the posts on this forum but did not find any examples that really applied.

I have several dozen files (mp3's) that have the format "song title - the artist name.mp3" and I want to rename them "artist name - song title.mp3". The primary problem I have with capturing the individual expressions is that the song title and the artist names vary with the number of words before and after the hyphen. Here are a few examples. Thanks in advance for your help.

From:
Tenessee Christmas - Alabama.mp3
25 Or 6 To 4-Chicago.mp3

To:
Alabama-Tenessee Christmas.mp3
Chicago-25 Or 6 To 4.mp3
mrvelous01
 
Posts: 2
Joined: Mon Jun 01, 2009 10:45 pm

Re: Reversing complex group-artist mp3 naming

Postby mrvelous01 » Tue Jun 02, 2009 12:24 am

Sorry, the title of the posting should have been "Reversing complex title-artist mp3 naming :)
mrvelous01
 
Posts: 2
Joined: Mon Jun 01, 2009 10:45 pm

Re: Reversing complex group-artist mp3 naming

Postby GMA » Tue Jun 02, 2009 6:43 am

Hi, mrvelous01:
This is what you need:

1. Set RegEx (1) as:
MATCH: (.*?)-(.*)
REPLACE: \2 - \1

2. In the Remove (5) field, check "Trim" (that'll remove any spaces left at the beginning of the file name).

3. Use the preview to see if everything's OK, and then press "Rename".

One thing; if there's no space before/after the hyphen (e.g.: "Title-Artist") it will be added as a result of the renaming process (e.g.: "Artist - Title"), which may or may not be a problem for you. If that IS a problem, then you're gonna have to use two different RegExs.
Cheers,

Gabriel.
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina


Return to Regular Expressions