INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Artist Name Swap expression  (Read 2191 times)

fitbrit

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4887
Artist Name Swap expression
« 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?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Artist Name Swap expression
« Reply #1 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.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Artist Name Swap expression
« Reply #2 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

fitbrit

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4887
Re: Artist Name Swap expression
« Reply #3 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!
Logged

fitbrit

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4887
Re: Artist Name Swap expression
« Reply #4 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!
Logged
Pages: [1]   Go Up