# Merging several Tag Fields into CONTENTGROUP

**URL:** https://community.mp3tag.de/t/merging-several-tag-fields-into-contentgroup/10616
**Category:** Support
**Created:** [July 4, 2010, 10:31pm UTC](https://community.mp3tag.de/t/merging-several-tag-fields-into-contentgroup/10616 "2010-07-04T22:31:01Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![ptrk.mj](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ptrk.mj/32/300_2.png) [@ptrk.mj](https://community.mp3tag.de/u/ptrk.mj)
#### Post date: [September 21, 2010, 1:42pm UTC](https://community.mp3tag.de/t/merging-several-tag-fields-into-contentgroup/10616/5 "2010-09-21T13:42:45Z")

</div>

> [@DetlevD](#):
>
> There is a Regular Expression ...  
> ... which should match duplicate comma-delimited items.  
> (?\<=,|^)([^,]\*)(,\1)+(?=,|$)

To be specific: it matches adjacent duplicate comma-delimited items. This limitation determines the need of a new approach to the subject.

I think I've come up with the right one:  
Edit: It is not the right one, actually. See below posts.

Action: Replace with regular expression  
Field: {comma- or comma+space- delimited list}  
Regular expression: `(?<=,|\A) ?([^,]*),(?=.*?(?<=,) ?\1(?=,|\z))`  
Replace matches with:

It's case-insensitive by default (i.e. will also delete items which differ from the others only by casing)  
As we may end up with a space at the begininng after removal from comma+space-delimited list I added second action to the group to strip that space.

Here's how it works all together:

From:  
aaa,aaa,aaa,bbb,ccc,bbb,ddd,ddd,ddd,ccc,eee,fff,GGG,ggg,iii  
To:  
aaa,bbb,ddd,ccc,eee,fff,ggg,iii

> [@](#):
>
> If we could sort a delimited itemlist within a tag-field, Mp3tag life would be much easier!  
> If we could repeat one action in a loop, Mp3tag life would be much easier!

Yes, I certainly agree with both!

---

_[View the full topic](https://community.mp3tag.de/t/merging-several-tag-fields-into-contentgroup/10616)._
