Regexp help


#1

I am trying to match a literal right round bracket ")" in the filter e.g.

%album% MATCHES \)

matches everything!

Other brackets are ok []{}( but not )

Is this expected behavior or a bug?


#2

The logical operator MATCHES expects a regular expression, what you did right.
This works ...
ALBUM MATCHES ")"
... or ...
"%ALBUM%" MATCHES ")"

See also ...
http://help.mp3tag.de/main_filter.html
There seems to be a difference between documentation and behaviour.

DD.20130201.0850.CET


#3

I think there was a thread somewhere in which the benefits of the various filter operators were layed out.
I think I remember that if you want to filter for simply a single known character (that does not require a regular expression) then the operator HAS would be the one with the better performance.
So,
ALBUM HAS ")"
would do the trick "better" (and the operator requires less typing :wink: )


#4

Good point.
(But ... 'better performance' is only a guess, because internally the operator HAS is assumingly implemented as a regular expression.)

A filter for names with a trailing closing round bracket ...
ALBUM MATCHES ")$"

Using a little trick the operator HAS can do it too ...
"%ALBUM%$" HAS ")$"
... or ...
"%ALBUM%===" HAS ")==="

DD.20130201.1333.CET


#5

OK thanks. Thanks also for the little tricks DetlevD. You seem to have a lot of tricks up your sleeve!

So for filter matching literal right round bracket: surround whole expression in double quotes.

But in this example by pone each literal round bracket is surrounded by single quotes:

Add parentheses To featured artist

Why is this necessary? Just trying to understand.


#6

Mp3tag provides several scripting languages, each one designed for special purpose.
Mp3tag Converter and Action Scripting Language
Mp3tag Export Scripting Language
Mp3tag Websource Scripting Language
Mp3tag Filter Scripting Language
Each scripting language follows its own rules.

DD.20130219.0814.CET