# How to workaround with duplicates in filename?

**URL:** https://community.mp3tag.de/t/how-to-workaround-with-duplicates-in-filename/18695
**Category:** Export
**Created:** [February 11, 2017, 8:29am UTC](https://community.mp3tag.de/t/how-to-workaround-with-duplicates-in-filename/18695 "2017-02-11T08:29:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![vvikkass](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/d26b3c/32.png) [@vvikkass](https://community.mp3tag.de/u/vvikkass)
#### Post date: [February 11, 2017, 8:29am UTC](https://community.mp3tag.de/t/how-to-workaround-with-duplicates-in-filename/18695/1 "2017-02-11T08:29:28Z")

</div>

Have mp3s (around 10000+ files) which have duplicates.

All the files I am talking about are in this format,

01 - Artist 1 - Title (Artist 2 Remix) (Artist 2 Remix).mp3

want duplicate texts to be removed from each mp3 file so that the final mp3 looks like this:  
01 - Artist 1 - Title (Artist 2 Remix).mp3

One common condition in all the mp3 is that the DUPLICATE TEXT is always inside ( & ). I can do replace for most cases like (Original Mix) (Original Mix) \> (Original Mix) and so on...but I want to know if there exists more professional solution to remove duplicates that are within ( ).

Thanks and best regards.

---

<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: [February 11, 2017, 9:59am UTC](https://community.mp3tag.de/t/how-to-workaround-with-duplicates-in-filename/18695/2 "2017-02-11T09:59:11Z")

</div>

> [@vvikkass](#):
>
> ... All the files I am talking about are in this format,  
> 01 - Artist 1 - Title (Artist 2 Remix) (Artist 2 Remix).mp3  
> want duplicate texts to be removed from each mp3 file so that the final mp3 looks like this:  
> 01 - Artist 1 - Title (Artist 2 Remix).mp3 ...

**\_FILENAME \<== $regexp(%\_filename%,'^(.+)(\s\(.+\)){2}$','$1$2')**

The above regexp does not check for identical content within the round brackets.

The following regexp does respect identical content within the round brackets.

**\_FILENAME \<== $regexp(%\_filename%,'^(.+?)(\s\(.+?\))\g{-1}$','$1$2')**

DD.20170211.1240.CET

---

<div class="post-metadata">

### Author: ![vvikkass](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/d26b3c/32.png) [@vvikkass](https://community.mp3tag.de/u/vvikkass)
#### Post date: [February 11, 2017, 11:09am UTC](https://community.mp3tag.de/t/how-to-workaround-with-duplicates-in-filename/18695/3 "2017-02-11T11:09:47Z")

</div>

> [@DetlevD](#):
>
> **\_FILENAME \<== $regexp(%\_filename%,'^(.+)(\s\(.+\)){2}$','$1$2')**
> 
> The above regexp does not check for identical content within the round brackets.
> 
> The following regexp does respect identical content within the round brackets.
> 
> **\_FILENAME \<== $regexp(%\_filename%,'^(.+?)(\s\(.+?\))\g{-1}$','$1$2')**
> 
> DD.20170211.1240.CET

Thanks 🙂

But I really dont know how to apply that regex code. Please help.

P.S. Please excuse me, I tried the FORMAT VALUE, and it worked flawlessly. Just genius.

Thanks a lot sir. 🙂

EDIT 2: One problem though.

If mp3 is in this format it dont work sir.  
01 - Artist 1 - Title (Artist 2 Remix) (Feat. Artist 3) (Artist 2 Remix).mp3

Will it be possible to get this sir,  
01 - Artist 1 - Title (Artist 2 Remix) (Feat. Artist 3).mp3

Means many mp3s have texts in between the two brackets such as featuring artists.

---

<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: [February 11, 2017, 12:35pm UTC](https://community.mp3tag.de/t/how-to-workaround-with-duplicates-in-filename/18695/4 "2017-02-11T12:35:19Z")

</div>

> [@vvikkass](#):
>
> 01 - Artist 1 - Title (Artist 2 Remix) (Feat. Artist 3) (Artist 2 Remix).mp3  
> 01 - Artist 1 - Title (Artist 2 Remix) (Feat. Artist 3).mp3

**\_FILENAME \<== $regexp(%\_filename%,'^(.+?)(\s\(.+?\))(\s\(.+?\))\g{-2}$','$1$2$3')**

Hmm, ...  
why don't you create the filenames fresh from the tag fields?

DD.20170211.1435.CET

---

<div class="post-metadata">

### Author: ![vvikkass](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/d26b3c/32.png) [@vvikkass](https://community.mp3tag.de/u/vvikkass)
#### Post date: [February 11, 2017, 12:41pm UTC](https://community.mp3tag.de/t/how-to-workaround-with-duplicates-in-filename/18695/5 "2017-02-11T12:41:04Z")

</div>

> [@DetlevD](#):
>
> **\_FILENAME \<== $regexp(%\_filename%,'^(.+?)(\s\(.+?\))(\s\(.+?\))\g{-2}$','$1$2$3')**
> 
> Hmm, ...  
> why don't you create the filenames fresh from the tag fields?
> 
> DD.20170211.1435.CET

it worked 😃

The problem is that the data is same in the tags or else I would have done TAGS\>FILE NAME earlier sir.
