# Populating a tag based on a word or string in another

**URL:** https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515
**Category:** Support
**Created:** [December 13, 2016, 2:34am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515 "2016-12-13T02:34:03Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [December 13, 2016, 2:34am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/1 "2016-12-13T02:34:03Z")

</div>

Hello,

I would like to know if there is a way to populate a tag based on a word or a string in another tag, either via regex or if statement.

eg. IF the ALBUM tag contains the word _Soundtrack_ or the strings _Best of_ or _Greatest Hits_, I would like to copy _Soundtrack_ to the RELEASETYPE tag, or if ALBUM contains _Best of_ or _Greatest Hits_ populate RELEASETYPE with _Best of / Greatest Hits Compilation Album_, and if COMPILATION is checked, then populate RELEASETYPE with _Various Artists Compilation_, otherwise populate RELEASETYPE with Album.

---

<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: [December 13, 2016, 5:21am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/2 "2016-12-13T05:21:08Z")

</div>

You may create an action group with individual actions for each condition.  
Use an action of the type "Format value" for the field RELEASETYPE with e.g. as  
Format string: $if($eql(%compilation%,1),Various Artists Compilation,%releasetype%)

Or if a search string is only part of the total string:  
Format string: "$ifgreater($strstr($upper(%album%),'BEST OF'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [December 14, 2016, 4:57am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/3 "2016-12-14T04:57:08Z")

</div>

> [@ohrenkino](#):
>
> You may create an action group with individual actions for each condition.  
> Use an action of the type "Format value" for the field RELEASETYPE with e.g. as  
> Format string: $if($eql(%compilation%,1),Various Artists Compilation,%releasetype%)
> 
> Or if a search string is only part of the total string:  
> Format string: "$ifgreater($strstr($upper(%album%),'BEST OF'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)

Could I use _$if($eql(%compilation%,),Album,%releasetype%)_ to fill RELEASETYPE with Album, if _%releasetype%_ is empty?

---

<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: [December 14, 2016, 5:03am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/4 "2016-12-14T05:03:54Z")

</div>

> [@DJ Dizzle](#):
>
> Could I use _$if($eql(%compilation%,),Album,%releasetype%)_ to fill RELEASETYPE with Album, if _%releasetype%_ is empty?

Have you tried it?

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [December 14, 2016, 6:11am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/5 "2016-12-14T06:11:33Z")

</div>

> [@ohrenkino](#):
>
> Have you tried it?

Ok, here is what I was able to do

FORMAT VALUE:

RELEASETYPE  
$if($eql(%compilation%,1),Various Artists Compilation,%releasetype%)  
$ifgreater($strstr($upper(%album%),'Best of'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)  
$ifgreater($strstr($upper(%album%),'Greatest Hits'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)  
$ifgreater($strstr($upper(%album%),'Soundtrack'),0,'Soundtrack',%releasetype%)  
$if($eql(%releasetype%,),Album,%releasetype%)

RELEASE EDITION  
$ifgreater($strstr($upper(%album%),'Deluxe Edition'),0,'Deluxe Edition',%releaseedition%)  
$ifgreater($strstr($upper(%album%),'Deluxe Version'),0,'Deluxe Version',%releaseedition%)  
$if($eql(%releaseedition%,),Standard,%releaseedition%)

ALBUM  
%album% (%releaseedition% %releasetype%)

The only thing I can't figure out is how to format: %album% [%releaseedition% %releasetype%]

---

<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: [December 14, 2016, 6:23am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/6 "2016-12-14T06:23:48Z")

</div>

> [@DJ Dizzle](#):
>
> ...  
> $ifgreater($strstr($upper(%album%),'Best of'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)  
> $ifgreater($strstr($upper(%album%),'Greatest Hits'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)  
> $ifgreater($strstr($upper(%album%),'Soundtrack'),0,'Soundtrack',%releasetype%)  
> ...

These expression will hardly ever return a string as you compare an uppercase "BEST OF" with an ordinary "Best of" which will never match.  
That is why I wrote

> [@](#):
>
> "$ifgreater($strstr($upper(%album%),'BEST OF'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)

This applies to all expression where you use $upper().

> [@](#):
>
> ...  
> The only thing I can't figure out is how to format: %album% [%releaseedition% %releasetype%]

Use Format value  
Format string: %album% '['%releaseedition% %releasetype%']'

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [December 14, 2016, 8:53am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/7 "2016-12-14T08:53:51Z")

</div>

> [@ohrenkino](#):
>
> These expression will hardly ever return a string as you compare an uppercase "BEST OF" with an ordinary "Best of" which will never match.  
> That is why I wrote
> 
> This applies to all expression where you use $upper().
> 
> Use Format value  
> Format string: %album% '['%releaseedition% %releasetype%']'

Is there any way to match the string case insensitive?

---

<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: [December 14, 2016, 9:01am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/8 "2016-12-14T09:01:46Z")

</div>

> [@DJ Dizzle](#):
>
> Is there any way to match the string case insensitive?

Well, you could transform both string parts with such a function:  
$ifgreater($strstr($upper(%album%),$upper('Best of')),0,'Best of / Greatest Hits Compilation Album',%releasetype%)

But then again, you could write "Best of" in capitals straight away as "BEST OF" ... and that is what I did.

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [December 14, 2016, 9:03am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/9 "2016-12-14T09:03:47Z")

</div>

> [@DJ Dizzle](#):
>
> Is there any way to match the string case insensitive?

Never mind, I just removed the _$upper_ test

---

<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: [December 14, 2016, 9:24am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/10 "2016-12-14T09:24:54Z")

</div>

> [@DJ Dizzle](#):
>
> Never mind, I just removed the _$upper_ test

I don't understand.  
Like that you will get hits only for strings where the ALBUM contains the string "Best of". You will not get hits for "Best Of" and "best of" - the $upper() plus the comparison with an all-capitals string makes it a sort of case-insensitive comparison.

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [January 13, 2017, 4:40pm UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/11 "2017-01-13T16:40:16Z")

</div>

Is there a test I can use to append FEATARTIST or ALBUMFEATARTIST to ARTIST or ALBUMARTIST with feat. preceding the FEATARTIST/ALBUMFEATARTIST if the former is not null?

---

<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: [January 13, 2017, 5:02pm UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/12 "2017-01-13T17:02:49Z")

</div>

> [@DJ Dizzle](#):
>
> Is there a test I can use ... if the former is not null?

$if(%FEATARTIST%, _... then ..., ... else ..._)

DD.20170113.1903.C ET

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [January 13, 2017, 5:30pm UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/13 "2017-01-13T17:30:50Z")

</div>

> [@DetlevD](#):
>
> $if(%FEATARTIST%, _... then ..., ... else ..._)
> 
> DD.20170113.1903.C ET

Yes, I understand if, then, else statements. But, what do I use for the then test... to test if it isn't empty?

---

<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: [January 13, 2017, 5:50pm UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/14 "2017-01-13T17:50:17Z")

</div>

> [@DJ Dizzle](#):
>
> Yes, I understand if, then, else statements. But, what do I use for the then test... to test if it isn't empty?

The test will be done by the $if clause ...

ARTIST \<== %ARTIST%$if(%FEATARTIST%,' feat. '%FEATARTIST%,)

... which means ...

If the tagfield FEATARTIST does exist by having some content in it, then append the content from FEATARTIST, else append nothing, to the tagfield ARTIST.

There is also an abbreviation ...  
ARTIST \<== %ARTIST%[' feat. '%FEATARTIST%]

DD.20170113.1950.CET, DD.20170114.0545.CET

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [January 14, 2017, 1:17am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/15 "2017-01-14T01:17:52Z")

</div>

> [@DetlevD](#):
>
> The test will be done by the $if clause ...
> 
> ARTIST \<== %ARTIST%$if(%FEATARTIST%,' feat. '%FEATARTIST%,)
> 
> ... which means ...  
> if the tagfield FEATARTIST does exist, then append FEATARTIST, else append nothing.
> 
> There is also an abbreviation ...  
> ARTIST \<== %ARTIST%[' feat. '%FEATARTIST%]
> 
> DD.201701.13.1950.CET

Is my understanding right that, if there is nothing explicitly entered in a tag, that that tag is not actually written to the file?

---

<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: [January 14, 2017, 3:33am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/16 "2017-01-14T03:33:15Z")

</div>

> [@DJ Dizzle](#):
>
> Is my understanding right that, if there is nothing explicitly entered in a tag, that that tag is not actually written to the file?

Yes, you are right.  
One tagfield, which has no content, does not exist.  
You can check this in the "Extended Tags..." view.

DD.20170114.0554.CET

---

<div class="post-metadata">

### Author: ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)
#### Post date: [January 16, 2017, 1:53am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/17 "2017-01-16T01:53:10Z")

</div>

That worked perfectly, Thank you.

Now, to expand on that. Is there a way to test if there is a ' feat. ...' string in the TITLE and ALBUM, then move that string (not copy) minus the ' feat. ' part, to the FEATARTIST and ALBUMFEATARTIST tags?

---

<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: [January 16, 2017, 8:56am UTC](https://community.mp3tag.de/t/populating-a-tag-based-on-a-word-or-string-in-another/18515/18 "2017-01-16T08:56:24Z")

</div>

> [@DJ Dizzle](#):
>
> ... Is there a way to test if there is a ' feat. ...' string in the TITLE and ALBUM, then move that string (not copy) minus the ' feat. ' part, to the FEATARTIST and ALBUMFEATARTIST tags?

There are many threads within the forum regarding the keyword "feat" or "featuring".  
There is one to start reading ...  
[/t/11096/1](https://community.mp3tag.de/t/11096/1)

To find other threads ...  
[https://www.google.de/?gws\_rd=ssl#q=site:mp...+featuring+move](https://www.google.de/?gws_rd=ssl#q=site:mp3tag.de+feat+featuring+move)

DD.20170116.1056.CET

---

<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/populating-a-tag-based-on-a-word-or-string-in-another/18515/19 "2026-02-09T12:26:34Z")

</div>


