# Split a tag to multiple tags

**URL:** https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724
**Category:** General Discussion
**Created:** [March 21, 2015, 3:41am UTC](https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724 "2015-03-21T03:41:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![PeaterParker](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@PeaterParker](https://community.mp3tag.de/u/PeaterParker)
#### Post date: [March 21, 2015, 3:41am UTC](https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724/1 "2015-03-21T03:41:20Z")

</div>

I'm trying to split a Tag Value to Multiple Tags.  
For Example, here's a COMMENT tag along with it's corresponding value.

**COMMENT** : Categories – Trumpet\\Genius

What i need want to achieve is:

**CATEGORIES** : Trumpet  
**CATEGORIES** : Genius

[here's](http://forums.musicbrainz.org/viewtopic.php?pid=8669#p8669) a similar problem. but i just can't figure it out.  
Hopefully someone can enlighten me.

---

<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: [March 21, 2015, 8:18am UTC](https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724/2 "2015-03-21T08:18:57Z")

</div>

First create an action of the type "merge duplicate fields" for comment and use as separator the underscore \_.  
After this you have the contents of the comment fields in one comment field.  
Now create an action of the type "Format tag-field" for CATEGORIES with the  
format string: %comment%  
This copies the content of COMMENT to CATEGORIES.  
Then create an action of the type "Split field by Separator" for CATEGORIES with the separator underscore \_.  
You should now have multiple instances of CATEGORIES in the files.  
Do whatever you like with the contents of COMMENT.

---

<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: [March 21, 2015, 10:09am UTC](https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724/3 "2015-03-21T10:09:00Z")

</div>

> [@Peater Parker](#):
>
> I'm trying to split a Tag Value to Multiple Tags. For Example, here's a COMMENT tag along with it's corresponding value.  
> COMMENT: Categories – Trumpet\\Genius ...  
> What i need want to achieve is:  
> CATEGORIES: Trumpet  
> CATEGORIES: Genius

You have pointed to an outside forum's message, which depends on a forum thread from here ...  
[/t/9027/1](https://community.mp3tag.de/t/9027/1)

If you see this text ... "Categories – Trumpet\\Genius" ...  
in Mp3tag within a listview field or tag panel field, ..  
then you have to do with a so called "multi-value" tag-field, ...  
because Mp3tag uses the "\\ double backslash" as the visual delimiter for multi values stored within one tag-field ...  
Value 1: Categories – Trumpet  
Value 2: Genius

Because you want to create a new multi-value tag-field CATEGORIES ...  
out of textual parts from the tag-field COMMENT, ...  
to be extracted from each single value out of the multi-value tag-field COMMENT, ...  
then you have to do it in few steps.

1. Copy COMMENT (meta values) to CATEGORIES (merged values).  
Action "Format value"  
Field: CATEGORIES  
Formatstring: $meta\_sep(COMMENT,'~')  
Result ...  
CATEGORIES = 'Categories – Trumpet~Genius'

2. Remove the unwanted text, for example by splitting the given text into parts.  
Action "Guess values"  
Source format: %CATEGORIES%  
Guessing pattern: %DUMMY% – %CATEGORIES%  
Result ...  
CATEGORIES = 'Trumpet~Genius'

3. Make CATEGORIES multi-value.  
Action "Split field by separator"  
Field: CATEGORIES  
Separator: ~  
Result ...  
CATEGORIES = 'Trumpet'  
CATEGORIES = 'Genius'

4. Ready.

All steps consolidated into one step ...

**Action "Format value" Field: CATEGORIES Formatstring: $replace($meta\_sep(COMMENT,'~'),'Categories – ',,'~','\\\\')**

DD.20150321.1216.CET

---

<div class="post-metadata">

### Author: ![PeaterParker](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@PeaterParker](https://community.mp3tag.de/u/PeaterParker)
#### Post date: [March 21, 2015, 9:11pm UTC](https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724/4 "2015-03-21T21:11:13Z")

</div>

Thx for the reply guys.

@DetlevD

In a previous version of MP3Tag, whenever i would perform a REGEX on multiple files, the values with "\\" in them would automatically be split over multiple tags. Which, i guess, is the intended behaviour.

In the current version of MP3Tag v2.69 however, the '\\' doesn't seem to split the values over multiple tags. To force "\\" conversion to multiple values, i have to CTRL+S the files individually.  
So after REGEX i'm left with what is seen on Extended Tags screenshot.  
As you can see its not a visual representation but rather literal one.

Now, if i apply the tags above with your action, the results has some undesired effects:  
_Action "Format value"  
Field: CATEGORIES  
Formatstring: $replace($meta\_sep(COMMENT,'~'),'Categories – ',,'~','\\')_

_White = need attention, it gets CATEGORIES as fieldname  
Purple = split values  
Grey = original tags_

Obviously the desired format would be:

> ARTIST LOCATION = American CATEGORIES = Genius CATEGORIES = Trumpet TRACK DECADE = 2010s

Maybe an even better approach? This way **B** would always the end up with the correct fieldname.

> 1. Is there a way to target fieldname **A** 2. Split **B** and **C** from the values 3. and then assign **B** as new fieldname, with **C** as value

Sorry for being a pain. Still learning here.

---

<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: [March 22, 2015, 5:47am UTC](https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724/5 "2015-03-22T05:47:26Z")

</div>

> [@Peater Parker](#):
>
> In a previous version of MP3Tag, whenever i would perform a REGEX on multiple files, the values with "\\" in them would automatically be split over multiple tags. Which, i guess, is the intended behaviour.

Yes, so far it was, even in Mp3tag v2.69 as I can tell.

> [@Peater Parker](#):
>
> In the current version of MP3Tag v2.69 however, the '\\' doesn't seem to split the values over multiple tags. To force "\\" conversion to multiple values, i have to CTRL+S the files individually.  
> So after REGEX i'm left with what is seen on Extended Tags screenshot.  
> As you can see its not a visual representation but rather literal one.

Obviously you are a friend of special characters.  
Well I have already detected, that you have used in your examples the en-dash '–' instead of the standard hyphen '-'.  
But that you are so angry, and cheat us with the backslash too, I had not expected.

Your 'backslash' seems to be some other character from the Unicode character set, which looks like a backslash, ... for example ...  
'\ Set minus (U+2216)'  
'╲ Box drawings light diagonal upper left to lower right (U+2572)'.  
See also ...  
[http://en.wikipedia.org/wiki/Backslash](http://en.wikipedia.org/wiki/Backslash)  
[http://de.wikipedia.org/wiki/Backslash](http://de.wikipedia.org/wiki/Backslash)

Before going deeper into your problem, you have to comprehensible describe and clarify how to create the situation as shown by your picture with the muti-value COMMENT tag-field.

On my side, when using the standard double backslash '\\', then Mp3tag works as expected and creates a multi-value tag-field in the moment when writing the tag to the file.

DD.20150322.0747.CET

---

<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: [March 22, 2015, 7:22am UTC](https://community.mp3tag.de/t/split-a-tag-to-multiple-tags/16724/6 "2015-03-22T07:22:16Z")

</div>

> [@Peater Parker](#):
>
> Obviously the desired format would be:
> 
> > ARTIST LOCATION = American CATEGORIES = Genius CATEGORIES = Trumpet TRACK DECADE = 2010s

To make long story short ... I made example actions for you ...

From ...  
COMMENT = Artist Location - American  
COMMENT = Track Decade - 2010s  
COMMENT = Categories - Genius~Trumpet

To ...  
ARTIST\_LOCATION = American  
CATEGORIES = Genius  
CATEGORIES = Trumpet  
TRACK\_DECADE = 2010s

Begin Action Group **Test2015#20150322.PeaterParker.Step1** 

Action #1  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **COMMENT**  
_Formatstring:_ **Artist Location - American\\Track Decade - 2010s\\Categories - Genius~Trumpet**

 

End Action Group **Test2015#20150322.PeaterParker.Step1** (1 Action)

 Begin Action Group **Test2015#20150322.PeaterParker.Step2** 

Action #1  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TEMP\_COMMENT**  
_Formatstring:_ **$meta\_sep(COMMENT,';')**

 

Action #2  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **ARTIST\_LOCATION**  
_Formatstring:_ **$replace($regexp($regexp(%TEMP\_COMMENT%,'Artist Location - ([^;]+)','$1\\'),'(Track Decade|Categories) - ([^;]+)',),';','\\')**

 

Action #3  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK\_DECADE**  
_Formatstring:_ **$replace($regexp($regexp(%TEMP\_COMMENT%,'Track Decade - ([^;]+)','$1\\'),'(Artist Location|Categories) - ([^;]+)',),';','\\')**

 

Action #4  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **CATEGORIES**  
_Formatstring:_ **$replace($regexp($regexp(%TEMP\_COMMENT%,'Categories - ([^;]+)','$1\\'),'(Track Decade|Artist Location) - ([^;]+)',),';','\\')**

 

Action #5  
_Actiontype 16:_ **Split fields by separator**  
_Field \_\_\_:_ **CATEGORIES**  
_Separator:_ **~**

 

Action #6  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TEMP\_COMMENT;COMMENT**

 

End Action Group **Test2015#20150322.PeaterParker.Step2** (6 Actions)

 

[Test2015\_20150322.PeaterParker.Step1.mta](https://community.mp3tag.de/uploads/default/original/2X/f/f7e6945ee09c48fb4a036282d6dd2f3dcb5ccfed.mta) (112 Bytes)[Test2015\_20150322.PeaterParker.Step2.mta](https://community.mp3tag.de/uploads/default/original/2X/8/8e510b3a62e46785e6f2a88b45f43090ff0cd508.mta) (627 Bytes)  
DD.20150322.0922.CET

 

[Test2015\_20150322.PeaterParker.Step1.mta](https://community.mp3tag.de/uploads/default/original/2X/f/f7e6945ee09c48fb4a036282d6dd2f3dcb5ccfed.mta) (112 Bytes)

 

[Test2015\_20150322.PeaterParker.Step2.mta](https://community.mp3tag.de/uploads/default/original/2X/8/8e510b3a62e46785e6f2a88b45f43090ff0cd508.mta) (627 Bytes)
