# 2 Actions: Append term to Genre unless term already exists and distribute terms to fields if not duplicated

**URL:** https://community.mp3tag.de/t/2-actions-append-term-to-genre-unless-term-already-exists-and-distribute-terms-to-fields-if-not-duplicated/59614
**Category:** Support
**Created:** [January 3, 2023, 11:37pm UTC](https://community.mp3tag.de/t/2-actions-append-term-to-genre-unless-term-already-exists-and-distribute-terms-to-fields-if-not-duplicated/59614 "2023-01-03T23:37:22Z")
**Posts on this page:** 1
**Showing post:** 8

<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: [January 4, 2023, 7:28am UTC](https://community.mp3tag.de/t/2-actions-append-term-to-genre-unless-term-already-exists-and-distribute-terms-to-fields-if-not-duplicated/59614/8 "2023-01-04T07:28:32Z")

</div>

> [@esumsea](#):
>
> unless it is. I also realized that if I only had 5 genres but the action defines 10 genres, it does not work

The guessing pattern has to match the source string exactly in that respect that the guessing pattern must not contain more target fields than the source offers.

For the other list:  
Here is a thread that deals with the removal of duplicate string parts from a list of words in a string:

> [@Merging several Tag Fields into CONTENTGROUP](https://community.mp3tag.de/t/merging-several-tag-fields-into-contentgroup/10616/3):
>
> Good question. There is a Regular Expression ... [http://www.regular-expressions.info/regexb...plicatecsv.html](http://www.regular-expressions.info/regexbuddy/duplicatecsv.html) ... which should match duplicate comma-delimited items. (?\<=,|^)([^,]\*)(,\1)+(?=,|$) Having this list of items ... "Female Vocalists, Indie, Indie Rock, Alternative, Rock, Indie Pop, Pop/Rock, Alternative Rock, Punk, Indie Rock, Alternative/Indie Rock, Alternative Pop/Rock, Garage Rock Revival, Bright, Fun, Stylish, Uplifting, Nostalgic, Exciting, Girls Night Out, Breakup" ... the…

Perhaps you could use that to get rid of duplicates and save yourself a number of $if().

Then, instead of the manually numbered genre fields, it may be an idea to create several fields of the type genre which then could be merged and separated with actions that do not need constant maintainance. Have a look at the $meta() and $meta\_sep() function as well as the actions to merge and split fields.

---

_[View the full topic](https://community.mp3tag.de/t/2-actions-append-term-to-genre-unless-term-already-exists-and-distribute-terms-to-fields-if-not-duplicated/59614)._
