# Converting the format of a tag field

**URL:** https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824
**Category:** Support
**Created:** [April 6, 2016, 11:18am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824 "2016-04-06T11:18:06Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![wetenhr](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/5fc32e/32.png) [@wetenhr](https://community.mp3tag.de/u/wetenhr)
#### Post date: [April 6, 2016, 11:18am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/1 "2016-04-06T11:18:06Z")

</div>

When I started using MP3TAG I chose to use the 'Composer' tag with the format First Name Last Name. So Vivaldi is tagged as Antonio Vivaldi.

I've decided I want to change this so the tagging format is Last Name, First Name, i.e. Vivaldi, Antonio.

My database contains some 3,500 different music albums so I do not want to try and do this manually! Can anyone tell me if it's possible to set up an automated process to do this, or guide me to other topics that might help me to do it?

Many thanks,  
Richard

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [April 6, 2016, 4:53pm UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/2 "2016-04-06T16:53:56Z")

</div>

perhaps see this thread: [/t/15886/1](https://community.mp3tag.de/t/15886/1)  
it leads to other threads but gives you fairly thorough picture about the technicalities and the semantics.

Still my opinion: leave the name as it is.

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [April 6, 2016, 5:42pm UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/3 "2016-04-06T17:42:31Z")

</div>

> [@wetenhr](#):
>
> When I started using MP3TAG I chose to use the 'Composer' tag with the format First Name Last Name. So Vivaldi is tagged as Antonio Vivaldi.
> 
> I've decided I want to change this so the tagging format is Last Name, First Name, i.e. Vivaldi, Antonio.

Maybe you should not change the composer-tag but add the additional tag %composersort%.

---

<div class="post-metadata">

### Author: ![wetenhr](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/5fc32e/32.png) [@wetenhr](https://community.mp3tag.de/u/wetenhr)
#### Post date: [April 8, 2016, 7:31am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/4 "2016-04-08T07:31:25Z")

</div>

Ohrenkino, thanks for all those links. There's probably everything I need to be able to do what I needed from that.

I had one issue with the format values suggested. Some of my Composers have three-part names, e.g. Ludwig Van Beethoven, Jimmy Van Heusen. The default conversion results in Beethoven, Ludwig Van (which is what I want), but also Heusen, Jimmy Van (when it should be Van Heusen, Jimmy).

This is by no means a big problem as I have relatively few three part names, and I think the most likely workaround will be to do the conversion and then manually do search and replace for the small number of rogue entries I will still have. but any suggestions on how best to deal with this would be most helpful.

Poster, I'm not sure what the tag ComposerSort would do here? Are you suggesting it could be used to avoid re-tagging the file altogether?

Thanks,  
R

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [April 8, 2016, 7:39am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/5 "2016-04-08T07:39:47Z")

</div>

> [@wetenhr](#):
>
> ... The default conversion results in Beethoven, Ludwig Van (which is what I want), but also Heusen, Jimmy Van (when it should be Van Heusen, Jimmy).  
> ...

Sorry, no help there, you have to do it manually.

The COMPOSERSORT field could help to leave the COMPOSER field as it is and still find Beethoven under B instead of L (for Ludwig).  
You could even abbreviate the name to just Beethoven in the COMPOSERSORT field. Not all players support the "-SORT" fields.

---

<div class="post-metadata">

### Author: ![wetenhr](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/5fc32e/32.png) [@wetenhr](https://community.mp3tag.de/u/wetenhr)
#### Post date: [April 8, 2016, 8:26am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/6 "2016-04-08T08:26:33Z")

</div>

I think now I have almost everything working to do the conversion as I want. My Format string is

$trimLeft($regexp(%COMPOSER%,'([^;]+)(\s[^;]+)','$2, $1'))

This performs the conversion correctly and removes the leading spaces. The few remaining problems I have with some three-part names can be resolved manually I think.

The one remaining question I have concerns the separator I'm using to split the fields. All my different composers are separated by \\ rather than ; as the string requires. I've experimented with changing the string to

$trimLeft($regexp(%COMPOSER%,'([^\\]+)(\s[^\\]+)','$2, $1'))

but that didn't work for me.

Can anyone advise me on either:

1. Adapting my string to account for the different separator I use
2. Using some other string to convert my separator from \\ to ;

Many thanks for any help you can give me.

R

PS Ohrenkino thanks for your further advice on three-part names and on using ComposerSort. I'll just do the manual tidy-up for three-part names, but I don't think ComposerSort will work for me.

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [April 8, 2016, 10:40am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/7 "2016-04-08T10:40:48Z")

</div>

> [@wetenhr](#):
>
> but I don't think ComposerSort will work for me.

Anyway, instead of changing and maybe destroying your already existing composer-tags, you should change your actions in saving the new content to %composersort%.

If you are satistied with the final result saving the composersort-content to %composer% will be done in seconds user a format-value-action.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [April 8, 2016, 10:57am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/8 "2016-04-08T10:57:07Z")

</div>

> [@wetenhr](#):
>
> 1. Adapting my string to account for the different separator I use 2. Using some other string to convert my separator from \\ to ; ...

A string list of textual values, which are separated by the sequence '; ' ...  
can be converted into a multi-value tag-field by replacing each occurence of '; ' with '\\'.  
Example ...

**ARTIST \<== $replace('Artist1; Artist2','; ','\\\\')**

The other way round ...

**ARTIST \<== $meta\_sep(ARTIST,'; ')**

DD.20160408.1456.CEST

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [April 8, 2016, 11:02am UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/9 "2016-04-08T11:02:18Z")

</div>

> [@wetenhr](#):
>
> ... My Format string is  
> $trimLeft($regexp(%COMPOSER%,'([^;]+)(\s[^;]+)','$2, $1')) ...

**$trimLeft($regexp(%COMPOSER%,'([^;]+)(\s[^;]+)','$2, $1')) .. gives the same result as ... $regexp(%COMPOSER%,'([^;]+)\s([^;]+)','$2, $1')**

DD.20160408.1502.CEST

---

<div class="post-metadata">

### Author: ![wetenhr](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/5fc32e/32.png) [@wetenhr](https://community.mp3tag.de/u/wetenhr)
#### Post date: [April 8, 2016, 3:33pm UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/10 "2016-04-08T15:33:13Z")

</div>

> [@DetlevD](#):
>
> **$trimLeft($regexp(%COMPOSER%,'([^;]+)(\s[^;]+)','$2, $1')) .. gives the same result as ... $regexp(%COMPOSER%,'([^;]+)\s([^;]+)','$2, $1')**
> 
> DD.20160408.1502.CEST

Detlev, I used the TrimLeft function as I found there were leading spaces left in front of the tag information if I didn't use it. It works well, anyway! R

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:26pm UTC](https://community.mp3tag.de/t/converting-the-format-of-a-tag-field/17824/11 "2026-02-09T12:26:11Z")

</div>


