INTERACT FORUM

More => Old Versions => JRiver Media Center 22 for Windows => Topic started by: fitbrit on February 12, 2017, 05:35:49 pm

Title: Artist Name Swap expression
Post by: fitbrit on February 12, 2017, 05:35:49 pm
There's a Regex for changing: First Name Last Name ===> Last Name, First Name

However, I would like to do the reverse: Last Name, First Name ===> First Name Last Name

I tried editing the regex of the existing one (thanks glynor and MrC), with no idea of what I was doing and it produced suitably amateurish results. Could anyone help here?
Title: Re: Artist Name Swap expression
Post by: blgentry on February 12, 2017, 05:47:01 pm
In my very limited testing this works:

Code: [Select]
regex([Artist],/#^(.+),\s*(.+)$#/,-1)[R2] [R1]
Let me know if that works for your cases.

Brian.
Title: Re: Artist Name Swap expression
Post by: marko on February 12, 2017, 06:10:06 pm
There's also an unswap() function built in...

Unswap(…)
Takes Lastname, Firstname and reverses it to Firstname Lastname.

http://wiki.jriver.com/index.php/String_Manipulation_Functions#Unswap

Title: Re: Artist Name Swap expression
Post by: fitbrit on February 13, 2017, 12:20:07 am
In my very limited testing this works:

Code: [Select]
regex([Artist],/#^(.+),\s*(.+)$#/,-1)[R2] [R1]
Let me know if that works for your cases.

Brian.

Thank you. That did work fine!

I solved the problem much less elegantly by using Fill Properties from Filename, since the majority of the folders had the structure:

E:\Media\CD\Last name, first name\[album]\file.wav

I created two custom fields called [Last name] and [First name]. Then ran Fill Properties from Filename.
Then changed [Artist] to [First Name Last Name].

A few albums were left over to mop up manually.

I figured I could wait a few hours for a forum response, but I could also play a little with tag manipulations like i did for the practice. I know which I will use in future though!
Title: Re: Artist Name Swap expression
Post by: fitbrit on February 13, 2017, 12:21:44 am
There's also an unswap() function built in...

Unswap(…)
Takes Lastname, Firstname and reverses it to Firstname Lastname.

http://wiki.jriver.com/index.php/String_Manipulation_Functions#Unswap

Thank you! I KNEW that there was this function somewhere, but I couldn't figure out where. I was looking in Clean File Properties. I forgot to look in the expressions. I'd used it in the past, and thought it was my imagination!