Switching first and last name of Artist

Hello, let me start by praising this excellent application.

As someone with a large collection of MP3s, I am looking for a way to switch the artist name to a different order.

Right now, most of my MP3s are in the following order:

Bruce Springsteen
Spice Girls

I would like reverse the order for artist names so it reads alphabetically, as follows:

Spice Girls
Springsteen, Bruce

Although I know I can make the change easily using the Artist field - select all the artist and make a global change - when dealing with compilations or soundtracks, this becomes tedious and onerous.

If there is a method to make these changes with a batch of files, please recommend. If not, please take this a suggestion for future versions. Thanks!

Action: Format Value
Field: Artist
String: $regexp(%artist%,(.) (.),$2',' $1)

Works only for artists with one sure name.
If you want Jon Bon Jovi to Bon Jovi, Jon (and not Jovi, Jon Bon) you have to use:
$regexp(%artist%,(.?) (.),$2',' $1)

Thank you so much for the format string!

Do you have a way to reverse that (remove the comma and put everything before the comma at the end)? Started downloading lyrics and none of the artists in that format are being found...


to transform "Springsteen, Bruce" into "Bruce Springsteen":
Action: Format Value
Fromatstring: $regexp(%artist%,(.)',' (.),$2 $1)

Awesome, thanks!

Taking what I've learned here and elsewhere, I've not got the following 5 actions to choose from when renaming Artists in this fashion; perhaps compiling them here may help others. (*Most of mine are set up as format field with the $regexp function but I tried to standardize them in describing them):

From "First Name(s) Last Name(s)" to "Last Name(s), First Name(s)" Format:
  1. Transform Artist from "A B" to "B, A" or "A B C" to "C, A B"
ex: "John Smith" to "Smith, John" or "John Michael Smith" to "Smith, John Michael"

Regular Expression Replace: "(.) (.)" with: "$2, $1"

  1. Transform Artist from "A B C" to "B C, A"
ex: "John Smith Jones" to "Smith Jones, John"

Regular Expression Replace: "(.?) (.)" with: "$2, $1"

  1. Transform Artist from "A B ©" to "B, A ©"
where "©" is any suffix you like following a two word name

Regular Expression Replace: "(.?) (.) (.*)" with: "$2, $1 $3"

From "Last Name(s), First Name(s)" to "First Name(s) Last Name(s)" Format:

4] Transform Artist from "B, A" to "A B" or "B, A ©" to "A B ©"

ex: "Smith, John" to "John, Smith" or "Joel, Billy & Elton John" to "Billy Joel & Elton John"

Regular Expression Replace: "^([\w]+),\s([\w]+)" with: "$2 $1"

I find this works well with all two-word names no matter if you've added more stuff to the end and it is safe to run on all artist who DON'T have comma's in their name field too; except for those who have more than two words in their proper name.

5] Transform Artist from "B C, A" to "A B C" or "C, A B" to "A B C"

ex: "Smith Jones, John" to "John Smith Jones" or "Smith, John Michael" to "John Michael Smith"

Regular Expression Replace: "(.)',' (.)" with: "$2 $1"

This simply takes everything before the comma and puts it at the end, which works great for all names, no matter how many words in the first or last, but doesn't play nice with non-name suffixes you may have added (like "Joel, Billy and Elton John").

Adding or Removing Leading "The "

6] Restore Leading "The " to Artists' Names

7] Delete Leading "The " and "A " from Artists' Names

Artist_Name_Actions.zip (1.77 KB)

Thank you very much for providing a solution to change the names.
It works for my director case as well.
But - to be very honest - I do not know why.
I am looking for a manual for this magix regexp-function.

Is there anybody in the forum who has created such a manual?
I checked the help pages but I do not understand how this fromatstring works.

Fromatstring: $regexp(%artist%,(.)',' (.),$2 $1)

What does the string (.*) means?
What does the string $2 $1 means?

From a very high perspective I believe it is clear.

  1. Look for the last letter in artist. Name this phrase as $1.
  2. Continue to search in artist. Name that phrase in $2.
  3. Replace $1 by $2 and add a comma.

Furthermore I saw in the forum the following expression: (.+?) (.+) :astonished:
What does that means?

I would be very happy to get more information about the regexp-function.

You may have a look at this part of the help:

The $regexp() function is more or less the same as the action "Replace with regular expression".

Hallo Ohrenkino,

Du hast mir bereits letztes Mal weitergeholfen. Die Hilfeseite habe ich mit auch schon angesehen. Ich werde dabei allerdings nicht schlau. daher habe ich meinen Text gepostet.

  • Wo ist dort beispielsweise die Beschreibung für (.*?)?
  • Warum sind Klammern notwendig ?
  • Was bedeutet der Punkt nach der ersten Klammer ? Dies finde ich nicht in der Beschreibung
  • Vielleicht liegt es auch nur an meinen mangelndem Sprachkenntnissen
    Für mich bedeutet " * repeated any number of times including zero" wiederholt jedes Mal einschließlich Null.
  • Warum braucht man zusätzlich das Fragezeichen? Laut Beschreibung. Wiederholt keinmal oder einmal? Was soll den wiederholt werden?

Ich denke, mir würde schon eine deutsche Beschreibung für den $regexp(%artist%,(.) (.),$2',' $1) nach dem %artist% und $regexp(%artist%,^([\w]+)\s([\w]+), $2',' $1) weiterhelfen.

Den letzten Teil habe ich mit meinen Halbkenntnissen mal versucht:

  1. Finde den Anfang des Textes
  2. Jeder Buchstabe wird bis auf einen Unterstrich wiederholt und in den String $1 abgelegt.
  3. Dann folgt ein Leerzeichen
  4. Anschließend wird der verbleibende Text erneut eingelesen und in den String $2 abgelegt
  5. Zum Schluß werden die beiden Strings vertauscht und mit einem Koma separiert.

Ist dies korrekt?

Hallo Ohrenkino,

was müßte ich schreiben, daß automatisch erkannt wird, daß wenn der Dirigentenname aus 3 Namensbestandteilen besteht z.B. Sir Charles Mackerras in Mackerras, Sir Charles umbenannt wird und wenn der Difigentenname nur aus 2 Namensbestandteilen wie z.B. Niklaus Harnoncourt besteht in Harnoncourt, Nikolaus umbenannt wird.

Falls 3 Bestandteile vorhanden (.) (.) (*.), dann $3, $1 $2 sonst $2, $1

Die if-Weiche kann ich nicht programmieren.
Falls ich die 3 Bestandteile nehme, läuft er mir bei den normalen zwei Bestandteilen ins Leere und macht nichts.

Gibt es hier eine Möglichkeit, dies zu programmieren? Wenn ja, wie?

Hallo Ohrenkino,

habe die Lösung bereits selbst gefunden. :rolleyes:
Auch bei drei Namensbestandteilen klappt es auch mit dem Suchmuster (.) .().

This is the English part of the forum, so please stay in English.

You see the (English) help pages in your local language, if you call the help from Mp3tag with F1 - so this might shed some more light on the topic.

The reason why your expression works is due to the "greadiness" of the expression: the first expression tries to grab as many hits as possible.

In general I am not a friend of swapping first and last name as this always causes havoc with names that have to stay that way: Pink Floyd, Rolling Stones, "Dave Dee, Dozy, Beaky, Mick & Tich", "Katrina & the Waves" and so on.
So, unless you want to keep a special advisory which name gets swapped and which one doesn't, I think it is easiest not to swap anything at all. My opinion.

Hi Ohrenkino,

Thank you so much for the hint with the F1 Button.
Now the things are clear.

So sorry for replying in German. However I tried to find a solution in the forum and than I was forwarded to the international page.

I fully agree to your remarks regarding the artist names when we talk about pop music. The same applies for the "The" in the artist's name. I like the original name.
However talking about classic music I want to have Mozart, Amadeus as a composer and Solti, Sir Georg as a conductor when I want to select some music from my streaming agent. But that's my personel optinion. Other people might have different opinions.

Thank you for your time you invested into my topic and help. It was always appreciated.

Perhaps you get the best of both worlds with the additional fields

These allow to apply a different naming scheme for the sorting ...