I need help understanding $regex in mp3tag

Hi guys,
I studied computer science but I seem to be totally misunderstanding regex in mp3tag. I mean, why is

$regexp(%title%,([a-z])+,_)

with
Drüg (feat. Emie)

producing
_D_r_ü_g_ _(_f_e_a_t_._ _E_m_i_e_)_
???

I expected
D_ü_ (____. E___)

$regexp(x,expr,repl) replaces the pattern specified by the regular expression expr in the string x by repl.

You have to keep in mind the provided scripting language has its own syntax and special chars.
It is recommended to put especially regex patterns in ' apostrophes so you don't have to escape each ( or [ character.
Try $regexp(%title%,'([a-z])+',_)

Thanks bud, I will try using apostrophes.

Still no luck... I don't get it.
$regexp(%title%,'([A-Z][a-z]\xdc\xfc\d\s)+',_)
is producing nothing. Shouldn't ([A-Z][a-z]\xdc\xfc\d\s)+ select Drüg, feat and Emie?

Afaik ([A-Z][a-z])+ finds every word that consists of uppercase and lowercase letters ranging from a to z. But in mp3tag literally nothing gets found or replaced at all. What am I missing? I am losing my believe in myself.

I found the solution... I have to include the | OR operator: $regexp(%title%,'([A-Z]|[a-z])+',_)
Now I can sleep in peace.

Maybe instead of $regexp(%title%,'([A-Z][a-z]\xdc\xfc\d\s)+',_)
you meant
$regexp(%title%,'([A-Za-z\xdc\xfc\d\s])+',_)
Understand the difference
[A-Z][a-z] vs [A-Za-z]

1 Like

The thing is that I tried that and didn't get to the solution I expected either. But I slowly begin to understand. However, thanks for your help.

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