# match some words from comment and put them in genre

**URL:** <https://community.mp3tag.de/t/match-some-words-from-comment-and-put-them-in-genre/15199>\
**Category:** Support\
**Created:** [November 13, 2013, 1:45pm UTC](https://community.mp3tag.de/t/match-some-words-from-comment-and-put-them-in-genre/15199 "2013-11-13T13:45:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ForSSound](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/258eb7/32.png) [@ForSSound](https://community.mp3tag.de/u/ForSSound)\
**Post date:** [November 13, 2013, 1:45pm UTC](https://community.mp3tag.de/t/match-some-words-from-comment-and-put-them-in-genre/15199/1 "2013-11-13T13:45:22Z")

</div>

Hi There,

I would like to populate Genre with certain words from the comment field.

example Comment ="Brass Band, drums, anthem, charming, guitar"

I would like to check this comment against a list and only put the words that match the list and are in the comment field into genre.

The checked words are provided in a list.

I thought ^(?=._?\b(?:word1)\b)|^(?=._?\b(?:word2)\b)|^(?=.\*?\b(?:word3)\b) would do the trick but it's not for this..

The list given with words will probable very big so I'm not even sure this is a good aproach.

Thanks for reading  
Guy Forssman

---

<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:** [November 13, 2013, 4:47pm UTC](https://community.mp3tag.de/t/match-some-words-from-comment-and-put-them-in-genre/15199/2 "2013-11-13T16:47:14Z")

</div>

> [@ForSSOund](#):
>
> ... populate Genre with certain words ...The list given with words will probable very big so I'm not even sure this is a good aproach.
> 
> Thanks for reading  
> Guy Forssman

You could apply a filter that has the words, e.g.  
%comment% MATCHES (Rock|Pop|Soul)

But as I cannot see any of the standard genres in your comment example I cannot give you any hint how to fill the genre tag.

---

<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:** [November 13, 2013, 5:43pm UTC](https://community.mp3tag.de/t/match-some-words-from-comment-and-put-them-in-genre/15199/3 "2013-11-13T17:43:06Z")

</div>

> [@ForSSOund](#):
>
> Hi There, I would like to populate Genre with certain words from the comment field.  
> example Comment ="Brass Band, drums, anthem, charming, guitar"  
> I would like to check this comment against a list and only put the words that match the list and are in the comment field into genre. The checked words are provided in a list. ...

If you would have dug deeper in the forum, you surely would have seen one or two or three solutions from previous times.  
Here comes a slightly new proposal using an action group for the given case.

Match text in tag field with text in text file.

An external text file will be read, containing the reference list of items, one per line.  
Note: in this proposal all text values are case sensitive.  
Then there will be created some temporary tag fields.  
After all matching and cleaning has done, then there will be remain one tag field,  
containing the list of the matched items.

You may modify the proposal to your needs, for example do a case insensitive matching,  
for example to get an user definable spell checker lookup action.

Begin Action Group **Test\_2013#MatchTextInTextlist** 

Action #1  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TMP\_GENRE**

 

Action #2  
_Actiontype 14:_ **Import text file**  
_Field \_\_:_ **TMP\_LIST**  
_Filename:_ **'T:\TEST\GenreList.txt'**

 

Action #3  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_LIST**  
_Formatstring:_ **$regexp($char(13)$char(10)%TMP\_LIST%$char(13)$char(10),'(\r?\n){2,}','\r\n')**

 

Action #4  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_COMMENT**  
_Formatstring:_ **%COMMENT%**

 

Action #5  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_1**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){0}(.+?)(?:,\s.\*|$)','$1')**

 

Action #6  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_2**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){1}(.+?)(?:,\s.\*|$)','$1')**

 

Action #7  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_3**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){2}(.+?)(?:,\s.\*|$)','$1')**

 

Action #8  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_4**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){3}(.+?)(?:,\s.\*|$)','$1')**

 

Action #9  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_5**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){4}(.+?)(?:,\s.\*|$)','$1')**

 

Action #10  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_6**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){5}(.+?)(?:,\s.\*|$)','$1')**

 

Action #11  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_7**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){6}(.+?)(?:,\s.\*|$)','$1')**

 

Action #12  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_8**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){7}(.+?)(?:,\s.\*|$)','$1')**

 

Action #13  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_ITEM\_9**  
_Formatstring:_ **$regexp(%TMP\_COMMENT%,'^(?:.+?,\s){8}(.+?)(?:,\s.\*|$)','$1')**

 

Action #14  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_1%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_1%,' ,'),%TMP\_GENRE%)**

 

Action #15  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_2%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_2%,' ,'),%TMP\_GENRE%)**

 

Action #16  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_3%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_3%,' ,'),%TMP\_GENRE%)**

 

Action #17  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_4%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_4%,' ,'),%TMP\_GENRE%)**

 

Action #18  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_5%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_5%,' ,'),%TMP\_GENRE%)**

 

Action #19  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_6%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_6%,' ,'),%TMP\_GENRE%)**

 

Action #20  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_7%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_7%,' ,'),%TMP\_GENRE%)**

 

Action #21  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_8%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_8%,' ,'),%TMP\_GENRE%)**

 

Action #22  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_GENRE**  
_Formatstring:_ **$ifgreater($len(%TMP\_LIST%),$len($regexp(%TMP\_LIST%,'\n('%TMP\_ITEM\_9%')\r',)),$trim(%TMP\_GENRE%', '%TMP\_ITEM\_9%,' ,'),%TMP\_GENRE%)**

 

Action #23  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TMP\_ITEM\_1;TMP\_ITEM\_2;TMP\_ITEM\_3;TMP\_ITEM\_4;TMP\_ITEM\_5;TMP\_ITEM\_6;TMP\_ITEM\_7;TMP  
\_ITEM\_8;TMP\_ITEM\_9**

 

Action #24  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TMP\_COMMENT;TMP\_LIST**

 

End Action Group **Test\_2013#MatchTextInTextlist** (24 Actions)

 

[Test\_2013\_MatchTextInTextlist.mta](https://community.mp3tag.de/uploads/default/original/2X/8/881c4bff8b73bff187897e2bb968ff6347e70fc7.mta) (2.63 KB)

 

DD.20131113.1943.CET

 

[Test\_2013\_MatchTextInTextlist.mta](https://community.mp3tag.de/uploads/default/original/2X/8/881c4bff8b73bff187897e2bb968ff6347e70fc7.mta) (2.63 KB)

---

<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:24pm UTC](https://community.mp3tag.de/t/match-some-words-from-comment-and-put-them-in-genre/15199/4 "2026-02-09T12:24:45Z")

</div>

Closed on February 9, 2026, 12:24pm UTC


