Delete repeated genre's in the same exact field

I have looked everywhere for a solution, and have found nothing to pre-exist. All the other posts anywhere close to this either deal with multiple fields (I have just one field) named Genre, don't work, or removes everything after the first \\'s, and are several years old posts.

I have ONE genre field (not multiple,) and want to cut out duplicates out of the same (not multiple) fields.

I can cut it down to this so that every word is separated and ready for it to be applied;

Notice how "metal" is repeated multiple times throughout the tag, among others. It can be cut down a ton, ignore that.
I want the duplicates of the same genre removed from the (singular) tag, each separated by \\, and not deleting anything past the first set of \'s, because I want to keep everything that isn't a duplicate.
Here's what I want the tag to visually be from the "cut down" one;

There's some junk in there I can filter out after, but the point is, I'm wanting to delete the genres that are repeated.

Can anybody help me figure out how to make this happen?

Here's some of the stuff I've tried;

Using "remove duplicate fields" or "merge duplicate fields" gives me this:


It removes everything but the very first genre, which I don't want.

I've used various regex but the result is the same and it removes everything but the first genre.

The dump that you kindly supplied shows data with a double backslash \\ which is in MP3tag usually the indicator that there are actually multiple fields of the same type.
Could you check the extended tags dialogue Alt-T whether how many fields of the type genre there are?
If you find several, then merge this field into one with an action of the type

and use something unlike the double backslash as separator. A (comma or) semicolon would be nice.
And then have a look at this thread:

I've messed with it for about 6 hours last night.

Yeah, everything is separated by \, and it seems like each \ creates a new field as opposed to any other separator which would otherwise define it as one single field.

I already saw that post and tried to use it with the "; " separator and it doesn't do anything at all.

Here's the Alt-T

Shows it all under one tag.

That is most astounding.
I just created a field with
Classic; Album; Rock; Blue; Folk; Hard; Rock; Country & Rock & Roll
Which should be reduced by 1 "Rock"
when treated with
$regexp($reverse($regexp($regexp($reverse($regexp($regexp(%Genre%,'^(\s+;*|\s*;+)+|(\s+;*|\s*;+)+$|((?<=;)\s+)|(\s+(?=;))',),'^|$',';')),'(;[^;]+)(?=(\1|;.*?\1))',),'^;+|;+$',)),'(?<=;)',' ')

And the preview in Convert>Tag-Tag shows:
"Classic; Album; Rock; Blue; Folk; Hard; Rock; Country & Rock & Roll" ->
"Classic; Album; Rock; Blue; Folk; Hard; Country & Rock & Roll"
which I think is just about right.
I also used it on
"Alternative; Metal; English; Groove; Nu-Metal; Heavy; Nu; Charts; Rock; Indie; Rock; Thrash" ->
"Alternative; Metal; English; Groove; Nu-Metal; Heavy; Nu; Charts; Rock; Indie; Thrash"

and this would lead me to the statement: works as designed.

Okay, so the issue was I was trying to automate this through Actions > Actions and making an action using "Replace with regex," when I should had been using Convert > Tag - Tag and putting in;


$regexp($reverse($regexp($regexp($reverse($regexp($regexp(%Genre%,'^(\s+;*|\s*;+)+|(\s+;*|\s*;+)+$|((?<=;)\s+)|(\s+(?=;))',),'^|,';')),'(;[^;]+)(?=(\1|;.*?\1))',),'^;+|;+,)),'(?<=;)',' ')

Everywhere I looked otherwise didn't explain this very well.

Would be nice if MP3Tag added that function under with Convert as well to automate it, because any way i've done it that way didn't work.

Or an action of the type "Format value". So there is no single place.
$Regexp() is a scripting function and may be used where a "format string" is required.
The action of the type "Replace with regular expression" asks for a source pattern (or something similar but no format string).
Also, you did not say in which action you tried to get it working.
Yet, the linked thread clearly states

So ...

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.