Regex not working in specific situation for (Featuring)

Hello there, usually this works well.

The track it's not doing anything to though is "20 Broken (Featuring Amy Lee).mp3"

I can't understand why it's not changing the formatting to "20 Broken (feat. Amy Lee).mp3?

Please let us copy & paste your existing regular expression and don't let us type it character by character.
Your screenshot is fine, but please add the regex formatted as code like this:
(?i)(\s)f(?:ea)?t(?:(?:\.?|\s)|uring)(?=\s)

BTW:
If you use a code snippet from this forum please read the exact use case.
This one is for some derivates of "featuring" if it is has a leading space.

Your example has an opening bracket (not a space) in front of "Featuring".

And your replacement text has also a space in front of ␣feat.
This would make "20 Broken ( feat. Amy Lee).mp3" if it would match at all.

5 posts were split to a new topic: Tool to visualize (and explain) regular expressions?

Try this:

find

(\s?)\bf(ea)?t(uring)?\b\s?\.?[^\w]

replace

\1feat.space
change the word "space" to real space

1 Like

For those who prefer a preview in Tag -> Tag:
Formatstring:
$regexp(%TITLE%,(\s?)\bf(ea)?t(uring)?\b\s?\.?[^\w],feat. ,1)

image

Hint:
The replacement feat. will replace both variants (uppercase and lowercase) F with a lowercase f as the OP asked.

Needs to be like this:

$regexp(%TITLE%,(\s?)\bf(ea)?t(uring)?\b\s?\.?[^\w],\1feat. ,1)

There should be \1 for cases like this:
Something featuring (featuring noone)

1 Like

You are right.

Whyever someone wants to see "feat. " twice:
Something feat. (feat. noone)
as result.

As always:
Be careful with such edge cases. The space between feat. and the opening bracket ( in
Something feat.␣(Featuring noone)
will be duplicated and results in
Something feat.␣␣(feat. noone)

The same is true for
Something featuring (Feat.␣noone)
which results in duplicated spaces after the second feat.
Something feat. (feat.␣␣noone)

␣ = space, just for better readability.

You've got a point.
Take a look at this, might work better:

$regexp(%TITLE%,(\b\s)?\s*\bf(ea)?t(uring)?\b\.?(?:(\s*|[^\w])),\1feat. ,1)

With my testings it turns this:

Mrs. X FT.         FT FEAT     FEAT. FEATURING    Ft ft Feat feat Feat. feat. Featuring featuring Mr. Y
20 Broken (Featuring      Amy Lee)
20 Broken (Feat      Amy Lee)
20 Broken (       Feat.      Amy Lee)
Something featuring     (featuring noone)
Something feat.      (featuring      noone)
Something           feat.      (featuring      noone)
Something featuring     (feat.      noone)
Something feat.     (feat.      noone)
Something feat     (feat      noone)
Something feat.     (      feat.      noone)
Something feat     (        feat      noone)
Something featuring (featuring noone)
Something feat. (feat. noone)
Something feat (feat noone)

Into this:

Mrs. X feat. feat. feat. feat. feat. feat. feat. feat. feat. feat. feat. feat. feat. Mr. Y
20 Broken (feat. Amy Lee)
20 Broken (feat. Amy Lee)
20 Broken (feat. Amy Lee)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)
Something feat. (feat. noone)