# Building A Tag with Substrings of the original Tag

**URL:** https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137
**Category:** Support
**Created:** [July 24, 2005, 8:07pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137 "2005-07-24T20:07:41Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![brucem0001](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@brucem0001](https://community.mp3tag.de/u/brucem0001)
#### Post date: [July 24, 2005, 8:07pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/1 "2005-07-24T20:07:41Z")

</div>

I am attempting to format portions of the tags in my music library. I would prefer to sort the artist's name by Sir Name first, then First name, and If Applicable, the Middle Name. For example given the two composer's names (this is two different files, not both names on the same file) "James Newton Howard" & "James Horner". I would like to resolve them as: "Howard, James Newton", & "Horner James". Furthermore, is there a way that I can detect when there are two different artists in a tag, seperate them, and processes their names individually, then rewrite the value of the tag in the desired format, i.e.: "Hans Zimmer, Henning Lohner, Martin Tillman" would resolve into "Zimmer, Hans; Lohner, Henning; & Tillman, Martin"

I suppose a lot of this problem boils down to Doing Conditional Testing within an Action. Is any of this possible?

Thank you in advance for any and all help you receive.

BruceM0001

---

<div class="post-metadata">

### Author: ![nickless](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nickless/32/36_2.png) [@nickless](https://community.mp3tag.de/u/nickless)
#### Post date: [July 25, 2005, 1:41pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/2 "2005-07-25T13:41:00Z")

</div>

Hi BruceM0001!

Try out the set of actions I've made (attachment).

Just copy the file to "%appdata%\Mp3tag\data\actions" folder and it should be available from action list (ALT+5) in Mp3Tag.

Regards  
nickless

[BruceM0001.mta](https://community.mp3tag.de/uploads/default/original/2X/4/47d022aa9721e0badaee9738e6f1d451da42edd8.mta) (168 Bytes)

---

<div class="post-metadata">

### Author: ![brucem0001](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@brucem0001](https://community.mp3tag.de/u/brucem0001)
#### Post date: [July 26, 2005, 2:30pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/3 "2005-07-26T14:30:40Z")

</div>

nickless,  
Thank you for your assistance. I have copied the file to the c:\Program Files\Mp3tag\data\actions" as you instructed, but the "Alt-5" Actions command still does not see the file. Any suggestions?

Thanks again.

BruceM0001

> [@](#):
>
> Hi BruceM0001!
> 
> Try out the set of actions I've made (attachment).
> 
> Just copy the file to "%appdata%\Mp3tag\data\actions" folder and it should be available from action list (ALT+5) in Mp3Tag.
> 
> Regards  
> nickless
> 
> \<{POST\_SNAPBACK}\>

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [July 26, 2005, 4:41pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/4 "2005-07-26T16:41:03Z")

</div>

> [@](#):
>
> nickless,  
> Thank you for your assistance. I have copied the file to the c:\Program Files\Mp3tag\data\actions" as you instructed, but the "Alt-5" Actions command still does not see the file. Any suggestions?
> 
> Thanks again.
> 
> BruceM0001
> 
> \<{POST\_SNAPBACK}\>

He said that you should copy it to %APPDATA% and not "Program Files". %APPDATA% (you can type that as-is in Windows Explorer since it's a Windows environment variable like %TEMP% and %WINDIR%) is usually "C:\Documents and Settings\<i\>\Application Data".

---

<div class="post-metadata">

### Author: ![brucem0001](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@brucem0001](https://community.mp3tag.de/u/brucem0001)
#### Post date: [July 26, 2005, 6:49pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/5 "2005-07-26T18:49:14Z")

</div>

Thanks for The Heads Up. I'll Bet It works Now.

---

<div class="post-metadata">

### Author: ![brucem0001](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/fbc32d/32.png) [@brucem0001](https://community.mp3tag.de/u/brucem0001)
#### Post date: [July 28, 2005, 3:45pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/6 "2005-07-28T15:45:18Z")

</div>

Thank you everyone who responded. Other than a minor case of "Short Circuit Between the Operator's Headset", everything went just fine, and the problem has been solved. I would love a bit more indepth explaination of the Regular Expression setup in the solution file. I'm new to regular expressions, and the solution uses a lot of features, on multiple levels.

Thanks Again

---

<div class="post-metadata">

### Author: ![nickless](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nickless/32/36_2.png) [@nickless](https://community.mp3tag.de/u/nickless)
#### Post date: [July 28, 2005, 10:10pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/7 "2005-07-28T22:10:45Z")

</div>

```
(^|; =?)([a-zA-Z -]*) (\S+)(?=$|;) 

```

It searches for 4 matches (in brackets) and replaces them in order $1$3, $2$4.  
First match is beginning of line or "; ", second is a set of chars of length \>= 0 , 3-rd is a set of not\_whitespaces of length \>0 and 4-th end of line or ;, while there must be a space between 2-nd and 3-rd, and 1-st match is a lookbehind and 4-th a lookahead 😉

RegEx can be a little complex, it's better to read the topic in the Help or have a look at [this](http://www.delorie.com/gnu/docs/regex/regex_toc.html) site.

Regards  
nickless

Edit: I've just noticed, that (^|; =?) is not a lookbehind (thx dano), =? is not necessary, only (^|; )([a-zA-Z -]\*) (\S+)(?=$|:wink: will work the same way.

---

<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:19pm UTC](https://community.mp3tag.de/t/building-a-tag-with-substrings-of-the-original-tag/2137/8 "2026-02-09T12:19:25Z")

</div>


