BRU and re-arranging text in a music filname.

A swapping-ground for Regular Expression syntax

BRU and re-arranging text in a music filname.

Postby Z06FTW » Tue Nov 13, 2018 2:30 am

Hello. I am new to the site but have been searching the boards for some time. I finally decided to post since I am having alil trouble in this renaming process.

Below are some examples of how the filenames are currently displayed upon opening the folder.

1. artist - name of song

This is the basic setup. Nothing needs to be done here because as I scroll down the folder, the artist will list in alphabetical order.
However, when I start getting filenames like the ones listed below...

2. artist ft artist2 - name of song
3. artist ft artist2 - name of song (Clean)
4. artist ft artist2 - name of song (Clean) (Remix Name)
5. artist ft artist2 & artist3 - name of song (Clean) (Remix Name)
6. artist vs artist2 vs artist3 - name of song (Remix Name)
7. artist & artist2 ft artist3 - name of song (Remix Name)
8. artist ft artist2 - name of song - Remix Name

...they are further down the list as far as alphabetical order because of (ft, vs, &).

I am wanting to keep the first artist (the original artist of the song) and have all other artist listed behind the song name in parenthesis in the filename like the examples below.

2. artist - name of song (ft artist2)
3. artist - name of song (ft artist2) (Clean)
4. artist - name of song (ft artist2) (Clean) (Remix Name)
5. artist - name of song (ft artist2 & artist3) (Clean) (Remix Name)
6. artist - name of song (vs artist2 vs artist) (Remix Name)
7. artist & artist2 - name of song (ft artist3) (Remix Name)
8. artist - name of song (ft artist2) - Remix Name

This method of renaming would keep the original as well as all remixes of the particular song grouped together in the folder.


I came up with this regular expression but it still is not getting the results I want.

MATCH: ([^-]+)(ft)([^-]+\w)\s*-\s*(.*)([\(])(.+)([\)])
REPLACE :\1- \4(\2\3) \5\6\7

I am also getting this with the above regExp

4. artist - name of song (Clean) (ft artist2) (Remix Name)
This is not ideal since (ft artist2) is between (Clean) (Remix Name).


I am ok if multiple RegEx need to be used.
Any help would be greatly appreciated.
Z06FTW
 
Posts: 1
Joined: Tue Nov 13, 2018 1:44 am

Re: BRU and re-arranging text in a music filname.

Postby bru » Thu Feb 07, 2019 7:47 pm

IF either SongNames/RemixNames can be like Remix - Name, dont even try to regex them.
In Explorer, search "* - * - *" to see if any might need to be manually renamed.
No regex would be reliable with a #8 example like: Some - Song - Name - Remix - Name.
Even a human (unfamiliar with Song/RemixNames) could get it wrong.

IF there arent any, and Space-Space always separates SongName, (& sometimes RemixName like in #8 example), the closest I can get to a single run:

#1Regex Match/Replace:
(.*?) (ft |vs |& )([^()]*?) +- +(.*?)( +- +(.+))* *( \([^)]*(\) +\([^)]*)*\)|$)
\1 - \4 (\2\3) (\6) \7

#5Remove: Words=()
#5Remove: D/S and Trim

That should get you much closer to what I think you are trying for?
bru
 
Posts: 62
Joined: Wed Jan 31, 2018 7:35 pm


Return to Regular Expressions