[X] Parentheses and Square Brackets Don't Work Correctly in Regexes

(Am using Mp3tag v2.57 on Windows 7.)

According to http://help.mp3tag.de/options_format.html#regexp , the following characters

. | * ? + ( ) { } [ ] ^ $

can be used in regular expressions by escaping them with a preceding backslash.

But while it works fine for most of the characters, it fails for parentheses and square brackets (but strangely, works for curly braces, which are also characters commonly used for grouping).

For example, in the function $regexp(), a parenthesis that leads to unbalancing, even an escaped one, will cause the expression to fail. Suppose you want to replace all opening or closing parentheses with the word "foobar"; supposedly, this should work (notice the parentheses are indeed escaped with a backslash):


but the former won't parse at all, instead giving "[ SYNTAX ERROR IN FORMATTING STRING ]", and the latter will parse, but is parsed incorrectly, as if that first closing parenthesis ended the $regexp function.

Similarly, these won't work


By contrast, curly braces work fine:


I was finally able to find a workaround by enclosing in single-quotes:


but the documentation makes no mention of how single-quotes can be used for this purpose.

Also, why do single-quotes work when double-quotes fail?

At the very least, the documentation should be updated to address these issues.

Please note that you're using a scripting function (i.e., $regexp()) and not the action type Replace with regular expression (for which the help topic is linked in your original post).

As noted at http://help.mp3tag.de/main_scripting.html

Kind regards

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