# Scripting Problem

**URL:** <https://community.mp3tag.de/t/scripting-problem/41152>\
**Category:** Support\
**Created:** [March 20, 2018, 9:48pm UTC](https://community.mp3tag.de/t/scripting-problem/41152 "2018-03-20T21:48:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wquatan](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@wquatan](https://community.mp3tag.de/u/wquatan)\
**Post date:** [March 20, 2018, 9:48pm UTC](https://community.mp3tag.de/t/scripting-problem/41152/1 "2018-03-20T21:48:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [March 21, 2018, 1:06am UTC](https://community.mp3tag.de/t/scripting-problem/41152/2 "2018-03-21T01:06:03Z")

</div>

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](https://www.regular-expressions.info)

---

<div class="post-metadata">

**Author:** ![wquatan](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@wquatan](https://community.mp3tag.de/u/wquatan)\
**Post date:** [March 21, 2018, 9:07am UTC](https://community.mp3tag.de/t/scripting-problem/41152/3 "2018-03-21T09:07:40Z")

</div>

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)`

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [March 21, 2018, 9:12am UTC](https://community.mp3tag.de/t/scripting-problem/41152/4 "2018-03-21T09:12:37Z")

</div>

Please see the help:

> **[Replace with Regular Expression – Mp3tag Documentation](https://docs.mp3tag.de/actions/replace-regexp/)**
>
> Documentation on the Replace with Regular Expression action type that can be performed as Quick Action or as reusable workflow from Action Groups. Mp3tag is the universal Tag Editor.

Quote from the help:

> [@](#):
>
> Literals
> 
> All characters except `. | * ? + ( ) { } [] ^ $.`  
> These characters are literals when preceded by a `"\". `

---

<div class="post-metadata">

**Author:** ![wquatan](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@wquatan](https://community.mp3tag.de/u/wquatan)\
**Post date:** [March 21, 2018, 9:41am UTC](https://community.mp3tag.de/t/scripting-problem/41152/5 "2018-03-21T09:41:26Z")

</div>

Hmmm.... hadn't discovered that !

Maybe a note should be added in [Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting) under the "Characters with special functionality" heading.

Something like  
"For Regular Expressions $regexp see also [Replace with Regular Expression – Mp3tag Documentation](https://docs.mp3tag.de/actions/replace-regexp)"

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [March 21, 2018, 11:41am UTC](https://community.mp3tag.de/t/scripting-problem/41152/6 "2018-03-21T11:41:38Z")

</div>

> [@wquatan](#):
>
> $regexp(%comment%,'\ )',,0)

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.

---

<div class="post-metadata">

**Author:** ![wquatan](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@wquatan](https://community.mp3tag.de/u/wquatan)\
**Post date:** [March 21, 2018, 11:57am UTC](https://community.mp3tag.de/t/scripting-problem/41152/7 "2018-03-21T11:57:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [March 21, 2018, 12:53pm UTC](https://community.mp3tag.de/t/scripting-problem/41152/8 "2018-03-21T12:53:42Z")

</div>

> [@wquatan](#):
>
> 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](https://docs.mp3tag.de/scripting) 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.

---

<div class="post-metadata">

**Author:** ![wquatan](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@wquatan](https://community.mp3tag.de/u/wquatan)\
**Post date:** [March 21, 2018, 1:08pm UTC](https://community.mp3tag.de/t/scripting-problem/41152/9 "2018-03-21T13:08:33Z")

</div>

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.
```

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [March 21, 2018, 1:34pm UTC](https://community.mp3tag.de/t/scripting-problem/41152/10 "2018-03-21T13:34:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:27pm UTC](https://community.mp3tag.de/t/scripting-problem/41152/11 "2026-02-09T12:27:18Z")

</div>


