Scripting Problem

I'm trying to use the special-chars () in $regexp.
As far I understood the single-quote has to be used for escaping ()
That seems to work in other functions, but not in $regexp

I'm using $regexp(%comment%,')',,0) and get the error

REGEXP ERROR: Regular expression
Found a closing ) with no corresponding opening parenthesis. The error occurred while parsing the regular expression: '>>>HERE>>>)'.

Same happens with '(', on the other hand '%' is ok

Escaping is done by the backslash in regular expressions.
\)

And to escape a backslash, you guessed it.
\\

This goes for all these char types. If something doesn't match in reg exp it needs to be escaped. A quick Google search will list these.

The ( ) are reserved chars for captures.

All the info you need is here: https://www.regular-expressions.info

Thank you, exactly what I needed.

As I had been searching (without luck) before asking, maybe it would be a good idea to add a small note (especially about the \ ) to the help-file of $regexp (with the link to the regular expressions site) and an example like $regexp(%comment%,'\)',,0)

Please see the help:

Quote from the help:

Hmmm.... hadn't discovered that !

Maybe a note should be added in Scripting Functions – Mp3tag Documentation under the "Characters with special functionality" heading.

Something like
"For Regular Expressions $regexp see also Replace with Regular Expression – Mp3tag Documentation"

This works?

$regexp(%comment%,\),0)
Should be used to replace ) with 0

You have a space after the escape whereas it should be immediately before.

I know.

I added the space because otherwise the \ was not shown in the reply, only the ) was shown.

But I see now how you did it, I'll change the original reply
To keep this topic clean if you wish you can delete your reply, I'll delete this one

This is still wrong in your post.
$regexp(%comment%,'\)',,0)

The fn here is
$regexp(x,expr,repl)

You've it wrote:
$regexp(x,expr,,repl)

Notice the extra ,

No need to delete. other people may learn from the mistakes shown.

No, it is not wrong.

the ) is to be replaced by nothing reason of the comma/comma
The 0 is the fourth parameter indicating "disable ignore case", but I agree that for this regexp it's of no meaning

$regexp(x,expr,repl) 
replaces the pattern specified by the regular expression expr in the string x by repl.
The fourth optional parameter enables ignore case (1) or disables the ignore case setting (0). 
Please note that you have to escape comma and other special characters in expr.

You're right. I forgot about that parameter.

I normally use (?i) to turn of case insentivity. And (?-i) to turn it on.

Reg exp:
(?i)matchthis(?-i)MATCHTHIS

Will match:
matchthisMATCHTHIS

But not:
MATCHTHISmatchthis

The advantage of this is you can turn it off and on throughout the regular expression and not be stuck with it either on or off.