Renaming karaoke files in order to flip lastname, firstname

A swapping-ground for Regular Expression syntax

Renaming karaoke files in order to flip lastname, firstname

Postby Alimento » Sat Jul 13, 2019 7:45 am

I searched heavily in the forums before posting this question. I did see a post where this was addressed; however, it did not show how to flip parts of the name of the song.

I would like to change the following:

Strait, George - Chair, The
to
George Strait - The Chair

This naming scheme would be very convenient for me using Virtual DJ.

Thank you in advance!
Jason
Alimento
 
Posts: 3
Joined: Sat Jul 13, 2019 7:29 am

Re: Renaming karaoke files in order to flip lastname, firstname

Postby therube » Sat Jul 13, 2019 11:05 am

therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: Renaming karaoke files in order to flip lastname, firstname

Postby Alimento » Sat Jul 13, 2019 5:47 pm

therube wrote:dash, viewtopic.php?p=10180#p10180


Hi, this does a great job at moving the name of the song to the beginning and placing the artist at the end. What I am looking for is changing the lastname, first name to first name last name without the comma for both the artist and song title.

Example

Beatles, The - I Want To Hold Your Hand
to
The Beatles - I Want to Hold Your Hand

I would like the comma removed and have and have the definite article "The" placed before "Beatles" so that it reads:
The Beatles - I Want to Hold Your Hand

I would also like to go a step further and do the same thing with the name of the song. There are some songs that have a definite or indefinite article using this comma scheme.

For example:

Animals, The - House of the Rising Sun, The

I would like to have it renamed like this:

The Animals - The House of the Rising Sun

So I pretty much anything with the format: last name, first name (or definite article) - song name, (definite or indefinite article) I would like changed so that it shows: first and last name without a comma followed by a dash then the name of the song. If the name of the song has a comma in it, I would like it removed and removed in front of the title song.

Here is one more example:

Mars, Bruno - Lazy Song, The
to
Bruno Mars - The Lazy Song

Any help would be greatly appreciated!
Thanks,
Jason
Alimento
 
Posts: 3
Joined: Sat Jul 13, 2019 7:29 am

Re: Renaming karaoke files in order to flip lastname, firstname

Postby Jack2 » Mon Jul 15, 2019 5:21 pm

I would also like to know the answer to this.

I had a go with

1)
s:(.*?),\s(.*?) - (.*?),\s(.*?)
r: \2 \1 - \4 \3

and also
2)
(.*?),\s(.*?)(\s-\s)(.*?),\s(.*?)
r: \2 \1 \3 \5 \4

and a few other variations, but it seems that ",\s(.*?)" just doesn't find the final ", The"

what's up?
Jack2
 
Posts: 30
Joined: Wed Nov 14, 2018 4:32 pm

Re: Renaming karaoke files in order to flip lastname, firstname

Postby therube » Mon Jul 15, 2019 8:14 pm

Sorry, I totally missed that...


This covers some of your cases:

1:RegEx:
Code: Select all
Match:  (.*?), (.*?) - (.*?), (.*)
Replace:  \2 \1 - \4 \3


I too, initially tried (.*?) for the last match, but that did not work, so had to change it to (.*).

That covers George Strait & Bruno Mars & The Animals.

With a quick look (now) & without anything coming to me as to handle The Beatles, until someone comes up with better, I'd limit your searches to the cover the patterns that you can replace.


In Everything, you can do something like:
Code: Select all
ww:the  regex:(.*?),\s(.*?)\s-\s(.*?),\s(.*)


ww = wholeword, so the word, 'the', has to turn up, & then the regex: part is the same (but Everything wants \s, where BRU accepts a space < >).

That turns up your files & also:
Gustav Holst, Levine - Uranus, The Magician
Emerson, Lake & Palmer - The Best Of Emerson, Lake & Palmer - 12 - Black Moon
(which you likely would not want to rename)

---

Once that part is taken care of go back & change your RegEx: to accommodate your other situations...
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm


Return to Regular Expressions


cron