match some words from comment and put them in genre

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 (2.63 KB)

DD.20131113.1943.CET

Test_2013_MatchTextInTextlist.mta (2.63 KB)