# Merge duplicate words

**URL:** https://community.mp3tag.de/t/merge-duplicate-words/16289
**Category:** Support
**Created:** [November 3, 2014, 9:33am UTC](https://community.mp3tag.de/t/merge-duplicate-words/16289 "2014-11-03T09:33:02Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [November 3, 2014, 4:11pm UTC](https://community.mp3tag.de/t/merge-duplicate-words/16289/3 "2014-11-03T16:11:46Z")

</div>

> [@ForSSOund](#):
>
> Hi,
> 
> I would like to find in genre duplicate words and merge them together.
> 
> This is an example of genre tag:
> 
> Before
> 
> ```
> AFRICA; AFRICA; NATURAL WORLD; NATURE STUDY; NATURE; DRAMA ADVENTURE; DRAMA WORLD; PERCUSSION; INSTRUMENTS SOLO PERCUSSION; WILDLIFE MOVEMENT; DRAMA ADVENTURE; AFRICA; FILM STYLES ANCIENT ROME; AFRICA
> 
> ```
> 
> After
> 
> ```
> AFRICA; NATURAL WORLD; NATURE STUDY; NATURE; DRAMA WORLD; PERCUSSION; INSTRUMENTS SOLO PERCUSSION; WILDLIFE MOVEMENT; DRAMA ADVENTURE; FILM STYLES ANCIENT ROME
> 
> ```
> 
> Kind regards  
> Guy Forssman

You want to keep the first value. That's more complicated.

[Edit:]  
Action: Format value  
Field: Genre  
Format string: `$regexp($reverse($regexp($regexp($reverse($regexp($regexp(%Genre%,'^(\s+;*|\s*;+)+|(\s+;*|\s*;+)+$|((?<=;)\s+)|(\s+(?=;))',),'^|$',';')),'(;[^;]+)(?=(\1|;.*?\1))',),'^;+|;+$',)),'(?<=;)',' ')`

Replace Genre with any other tag and it will remove duplicates too.  
This action "fixes" first the multiple value string (remove multiple spaces after ; separator).  
It will add exactly one space after value separator [;].

Enjoy. 😉

---

_[View the full topic](https://community.mp3tag.de/t/merge-duplicate-words/16289)._
