Add space to, swap Lastname,Firstname

Hi,

In the artist field, when the artists name is in the form "lastname,firstname" , how do I....

-separate the two names/add a space
-remove the comma and
-swap the last and first names?

Thank-you in advance if anyone can be of help.

If you have a field: lastname,firstname
or something like this: lastname , firstname
and want it to be: firstname lastname
you may create an Action with the following properties:
Field: your_fieldname
Regular Expression: (.*),(.*)
Replace matches with: $trim($2) $trim($1)
DD.20060623.0625

Thanks DetlevD...I gave that a try first thing this morning before heading out to work this morning and I couldn't be happier.

Thanks again.

Briliant!

Was looking for This!!

A+

Before I reinvent the wheel: Is there a known way to do something like the reverse, to change a field with, say, "John Coltrane" to "Coltrane, John" by swapping the words and placing a comma after the one moved to the first position? I do this a lot by hand (and realize that I would have to look at the contents before doing it to avoid messing up "Jethro Tull").

Yes, that wheel has been invented a long time ago,
See the HowTos:

I use this action to perform this for albumartist values:
Replace with regular expression:
Field:

ALBUMARTIST

Regular expression:

([^; ]+\s?[^; ]+(?:\s?[^; ]+)?)\s(?!Duo|Trio|Quartet|Quartetto|Quintet|Sextet|Sixtet|Sestetto|Septet|Octet|Ottetto|Nonet|Orchestra|Chamber Orchestra|Ensemble)([^; ]+)

Replace matches with:
$2, $1

It's more wordy because it also works on multiple albumartist values delimited by ";". And I added a few obvious things that should be avoided like trying to swap quartet, duo, trio etc. names.
It's not perfect but

as long as you're careful, it works pretty well for me.


Here's an example usage that also shows a limitation of my action. The skipping of duo, trio etc. only works if the albumartist only consists of 2 words. If it has 3, the 3rd one is skipped but the first 2 are still swapped. See "Cologne Saxophone Quartet" which becomes "Saxophone, Cologne Quartet".
This action works both for values separated by ";" and for real multi values "//".

I hope it gives you some ideas. :slight_smile:

See also this discussion whether it really makes sense to swap at all:

and if it is really necessary "because of reasons", consider the use of the ~SORT fields (ARTISTSORT, TITLESORT etc.).