How to remove parenthesis (with a certain condition)


#1

I have some songs where the title contains "(feat. Random Artists)" but I'd like for it to simply say "feat. Random Artists". I know how to make the symbol in "(feat." disappear, but I don't know to have the last ")" disappear without also having every ")" in the title disappear, like if I had something like "(Remix)" in the title. I hope my question makes sense...


#2

Are you familiar with RegEx? You can create a custom Action using "Replace with regular expressions", that would allow you to do what you're asking. Replace ((feat[^)]*)) with $1, that should remove the parenthesis from anything that matches (feat whatever), but not from (whatever). That will include (feat. whatever) and (featuring whatever). You may want to try that on some test files first, I know Regex but I'm no expert.


#3

EXCELLENT! Thank you so much! I wish I were more familiar with RegEx. :frowning:


#4

i know this topic is old, but i've got some issues.

my problem is, that in some featurings i got some inner parentheses. just an example for an artist: wyclef jean (feat. dwayne (the rock) johnson)...

my problem now is, that when i want to remove the parentheses, it will be: wyclef jean feat. dwayne (the rock johnson)... so how can i make this function always picks the last parenthese to remove? i never havea nything written behind the featurings, so the script should just go until the last parenthese ")"... thanks already now

greetings


#5

RegEx is incapable of matching the ending parenthesis of a nested group, but if you're certain that in every tag the ending parenthesis will be the last character in the field, use this in place of the RegEx string mentioned above: (feat.*

This will match anything and everything after (feat


#6

thanks for your answer. .)

but now, i have the problem, that the featurings are just erased, and not just the paranthesis are removed...
in the "replace matched field with", i still have $1.

don't i have to change something there too?


#7

Set Mp3tag Filter:

ARTIST MATCHES "^.+?\(feat.+?(\(.+?\))?.+?\)$"

Action: Format value
Field: ARTIST
Formatstring:

$regexp(%ARTIST%,'^(.+?)\((.+?)\)$','$1$2')

From:
wyclef jean (feat. dwayne (the rock) johnson)
wyclef jean (feat. dwayne johnson)
To:
wyclef jean feat. dwayne (the rock) johnson
wyclef jean feat. dwayne johnson

DD.20110607.1107.CEST


#8

perfect!

thank you very!


#9

filter is not necessary.

Action: Format Value
Field: ARTIST
Formatstring: $regexp(%artist%,'((|[)(ft|feat|featuring).?(.+)()|])',feat.$3,1)

works for round an and square parentheses.
works for ft, feat, and featuring, with or without dot and written with small or large letters.
replaces all ft/feat/featuring spellings into "feat.".
erases always the first and the last parenthesis.


#10

even better. :smiley:

now i have another problem. i know it's the wrong thread but i don't know if it's worth starting a new thread. have a lot of titles in a way like that:

l'enfer (& east, fabe & rahzel) - iam

how can i change it to:
l'enfer - iam, east, fabe & rahzel

because i always just really want the tilte in the title field, and the artists in the artist field. because of the "album artist" field, this isn't a problem anymore. :slight_smile:
for the featurings, i already did it with a function of this forum. but how can i make it for the '&'?


#11

try this:

Action: Guess Values
Source format: %artist% $regexp(%title%,'(.+) ((|[)((?:featuring|feat|ft|&|and|with|vs).? .+)()|])',$3+++$1,1)
Guessing pattern: %artist%+++%title%

I have expanded the list a bit (&, and, with, vs). You just have to check that the additional words are not a real part of the title.
Tiltes like:
I love you (and me)
I'm sick (with love)

would make problems.


#12

Yes, not necessary, but safe ... and makes the regular expression simple.

Yes, pone's expression works for almost all cases and has been stored already in my database.

I did a small modification, so the replacement of the 'featuring' derivatives works even without enclosing brackets, but leave extra brackets in the middle.

$regexp(%TITLE%,'[([]?(?:ft|feat|featuring)\.?\s+(.+)[)]]?\s*','feat. $1',1)

From:
wyclef jean featuring dwayne (the rock) johnson
wyclef jean (feat. dwayne (the rock) johnson)
wyclef jean ft. dwayne the rock johnson
wyclef jean with dwayne the rock johnson

To:
wyclef jean feat. dwayne (the rock) johnson
wyclef jean feat. dwayne (the rock) johnson
wyclef jean feat. dwayne the rock johnson
wyclef jean with dwayne the rock johnson

DD.20110607.1247.CEST


#13

thanks detlev

this almost works, but for now, the new artist is formed that way:

joe morton & sharon riley, the faith chorale, taj mahal & sam moore

this means, the first ' &' should be replaced by a ',' if there are more than 2 artists in total. but i have no idea how to implement this in the code. :confused:

does anyone have some tips?


#14

my string above keeps these words/symbols as found in the title: featuring|feat|ft|&|and|with|vs

you can change that to the following:

Action: Guess Values
Source format: %artist%$regexp(%title%,'(.+) ((|[)(?:featuring|feat|ft|&|and|with|vs).? (.+)()|])',', $3+++$1',1)
Guessing pattern: %artist%+++%title%

Now, everyone of the words is replaced by a comma. Note that you need addtional 'single quotationmarks' if you need a comma as literal character

But if you want this replacement only for more than two artists it gets more complicated to make it automatic.
You could make another $regexp function around the whole thing, which replaces the first "&" or "and" when another "&" or "and" follows.:

Action: Guess Values
Source format: $regexp(%artist%$regexp(%title%,'(.+) ((|[)((?:featuring|feat|ft|&|and|with|vs).? .+)()|])',$3+++$1,1),(&|and)(.+)(&|and)(.++++.+),',$2$3$4')
Guessing pattern: %artist%+++%title%


#15

wow, you're awesome. it works correctly now. thank you very for your time and help.

good afternoon
greetz