# Probelm with regexp...

**URL:** https://community.mp3tag.de/t/probelm-with-regexp/13241
**Category:** Support
**Created:** [March 20, 2012, 2:18pm UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241 "2012-03-20T14:18:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jbuszkie](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/f4b2a3/32.png) [@jbuszkie](https://community.mp3tag.de/u/jbuszkie)
#### Post date: [March 20, 2012, 2:18pm UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241/1 "2012-03-20T14:18:03Z")

</div>

I'm trying to extract an artist from a title and I'm running into issues.  
I've tried regexp web testers and the code seems fine. But when I use it in MP3Tag.. I get an errors.

example title:  
I'm Every Woman [Whitney Houston]

Format value  
Field: ARTIST  
Format string: $regexp(%title%,(._) [(._)],$2)

This is the error I get:  
**REGEXP ERROR: Regular expression**

Escape sequence terminated prematurely. The error occurred while parsing the regular expression: '(.\*) \>\>\>HERE\>\>\>'.

What am I missing? This isn't a complicated expression. I tried double escaping the [ with \\[  
but that didn't help.

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [March 20, 2012, 2:47pm UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241/2 "2012-03-20T14:47:47Z")

</div>

You are missing the Mp3tag Scripting Syntax  
[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
If you are using one of these characters: []$%,()  
you have to put them (or the whole expression) in single quotes to escape Mp3tag scripting.

$regexp(%title%, **'** (._) [(._)] **'** ,$2)

---

<div class="post-metadata">

### Author: ![jbuszkie](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/f4b2a3/32.png) [@jbuszkie](https://community.mp3tag.de/u/jbuszkie)
#### Post date: [March 20, 2012, 2:58pm UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241/3 "2012-03-20T14:58:34Z")

</div>

> [@pone](#):
>
> You are missing the Mp3tag Scripting Syntax  
> [https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
> If you are using one of these characters: $%,()  
> you have to put them (or the whole expression) in single quotes to escape Mp3tag scripting.
> 
> $regexp(%title%, **'** (._) [(._)] **'** ,$2)

Thanks!

I missed that. I was just about to post that I found out that I needed the single quotes.  
most of the searches in the forum for $regexp didn't use the single quote. I found one that did and said "hmm.." and that's when it started working!

And now that I read the full scripting section I see the

```
Characters with special functionality
[...] The contents of brackets are displayed only if at least one of the placeholders used inside the brackets has been found.
' Outputs raw text without parsing. This will output the contained string and ignore all reserved characters. If you want to output this character please use ''.
[]$% You have to put the single quote around these reserved characters if you want to use them unparsed.
,() These characters must only be escaped when they are inside a scripting function.

```

Thanks for the help!

Jim

---

<div class="post-metadata">

### Author: ![LosMintos](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/54ee81/32.png) [@LosMintos](https://community.mp3tag.de/u/LosMintos)
#### Post date: [March 21, 2012, 2:15pm UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241/4 "2012-03-21T14:15:18Z")

</div>

The single quotation marks might be added in the help regarding replace with regular expressions, [https://docs.mp3tag.de/actions/replace-regexp](https://docs.mp3tag.de/actions/replace-regexp). There,

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

is stated. This confused me a couple of days ago, when I tried to escape a (.

I filed a bug report, although this is a minor issue only, [/t/13247/1](https://community.mp3tag.de/t/13247/1).

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [March 21, 2012, 3:33pm UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241/5 "2012-03-21T15:33:38Z")

</div>

> [@LosMintos](#):
>
> The single quotation marks might be added in the help regarding replace with regular expressions, [https://docs.mp3tag.de/actions/replace-regexp](https://docs.mp3tag.de/actions/replace-regexp). There, is stated. This confused me a couple of days ago, when I tried to escape a (.
> 
> I filed a bug report, although this is a minor issue only, [/t/13247/1](https://community.mp3tag.de/t/13247/1).

Your confusion isn't cleared yet. The single qotation mark has not to be added to the characters with special funcitions for regular expressions. It has only a special function at "function scripting"

The "problem" is, that Mp3tag has different scripting languages, which can be combined at some places:

1. Function scripting:  
[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
Special characters: $%,()  
Escape with: '

2: Web Sources scripting:  
[https://docs.mp3tag.de/tag-sources](https://docs.mp3tag.de/tag-sources)  
Special characters: "#  
Escape with: \

3: Filter scripting:  
[https://docs.mp3tag.de/filter](https://docs.mp3tag.de/filter)  
Special characters: "  
can not be escaped

4: Regulare Expressions scripting:  
[https://docs.mp3tag.de/actions/replace-regexp](https://docs.mp3tag.de/actions/replace-regexp)  
Special characters: . | \* ? + ( ) { } ^ $.  
Escape with: \

Regular Expressions can be combined with the three other scripting "enviroments". But you only have to care about single quotes or the double function of if you combine it with Function scripting.

---

<div class="post-metadata">

### Author: ![LosMintos](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/54ee81/32.png) [@LosMintos](https://community.mp3tag.de/u/LosMintos)
#### Post date: [March 26, 2012, 11:55am UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241/6 "2012-03-26T11:55:27Z")

</div>

> [@pone](#):
>
> Your confusion isn't cleared yet. The single qotation mark has not to be added to the characters with special funcitions for regular expressions. It has only a special function at "function scripting"
> 
> The "problem" is, that Mp3tag has different scripting languages, which can be combined at some places:

Okay, thanks for giving me advice! It's hard to understand when consulting single sections of MP3Tag's help (at least for me), but I don't mean to be critical! If I could, I would come up with constructive feedback.

---

<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:23pm UTC](https://community.mp3tag.de/t/probelm-with-regexp/13241/7 "2026-02-09T12:23:44Z")

</div>


