# Bug when replacing regular expressions?

**URL:** <https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050>\
**Category:** Support\
**Created:** [June 20, 2016, 11:28am UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050 "2016-06-20T11:28:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bluenote](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Bluenote](https://community.mp3tag.de/u/Bluenote)\
**Post date:** [June 20, 2016, 11:28am UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050/1 "2016-06-20T11:28:03Z")

</div>

With the help of this forum (and some useful online regex resources) I've been trying to automate my renaming of song titles. What I have is:

```
Field:
TITLE

Regular expression:
(.+)\s\((.+)\)

Replace matches with:
$1 [$lower($2)]

```

I'm basically trying to replace any parentheses with square brackets, and also change the case of what's inside these parens, so that:  
**Outlaw Blues (Take 1, Complete)**  
becomes  
**Outlaw Blues [take 1, complete]**

Unfortunately, MP3tag renames it: **Outlaw Blues [take 1]**. I can't see any reason why it ignores the stuff after the comma, my expression seems sound (checked with [RegExr](http://regexr.com)). I'm thinking this is a bug, or am I missing something?

Thanks in advance for any replies!  
Bluenote

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [June 20, 2016, 12:50pm UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050/2 "2016-06-20T12:50:21Z")

</div>

> [@Bluenote](#):
>
> ... I'm basically trying to replace any parentheses with square brackets, and also change the case of what's inside these parens, so that:  
> **Outlaw Blues (Take 1, Complete)**  
> becomes  
> **Outlaw Blues [take 1, complete]**  
> Unfortunately, MP3tag renames it: **Outlaw Blues [take 1]**. ...

There seems to be a bug in the action "Replace with regular expression", ...  
when a string function is applied in the regex's replace string.

**Action "Format value" Field: TEST Formatstring: 'Outlaw Blues [Take 1, Complete]' ==\> TEST = Outlaw Blues [Take 1, Complete] Action "Format value" Field: TEST Formatstring: $regexp(%TEST%,'(.+)\s\((.+)\)','$1 [\L$2]') ==\> TEST = Outlaw Blues [take 1, complete] ------------------------------------------------ Action "Format value" Field: TEST Formatstring: 'Outlaw Blues (Take 1, Complete)' ==\> TEST = Outlaw Blues (Take 1, Complete) Action "Replace with Regular Expression" Field: TEST Regular expression: (.+)\s\((.+)\) Replace matches with: $1 [\L$2] ==\> TEST = Outlaw Blues [take 1, complete] ------------------------------------------------ Action "Format value" Field: TEST Formatstring: 'Outlaw Blues (Take 1, Complete)' ==\> TEST = Outlaw Blues (Take 1, Complete) Action "Replace with Regular Expression" Field: TEST Regular expression: (.+)\s\((.+)\) Replace matches with: $1 [$lower($2)] ==\> TEST = Outlaw Blues [take 1]\<== Failure ------------------------------------------------**

DD.20160620.1650.CEST

---

<div class="post-metadata">

**Author:** ![Bluenote](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Bluenote](https://community.mp3tag.de/u/Bluenote)\
**Post date:** [June 20, 2016, 1:31pm UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050/3 "2016-06-20T13:31:05Z")

</div>

> [@DetlevD](#):
>
> There seems to be a bug in the action "Replace with regular expression", ...  
> when a string function is applied in the regex's replace string.

Thank you!  
I didn't realize I could replace **$lower** with **\L**. That worked!

By the way, how did you generate the output from your tests? I wasn't able to find this option in MP3tag.

Thanks again.

---

<div class="post-metadata">

**Author:** ![Rijkstra](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rijkstra/32/22_2.png) [@Rijkstra](https://community.mp3tag.de/u/Rijkstra)\
**Post date:** [June 20, 2016, 3:52pm UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050/4 "2016-06-20T15:52:45Z")

</div>

> [@Bluenote](#):
>
> I didn't realize I could replace **$lower** with **\L**. That worked!

How does that work when \L is supposed to represent a non-lower case character?

The bug in the function seems to be the order of evaluation of commas. It seems to be backward and the text following the comma is interpreted as a bad parameter.

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [June 20, 2016, 4:44pm UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050/5 "2016-06-20T16:44:10Z")

</div>

> [@Rijkstra](#):
>
> How does that work when \L is supposed to represent a non-lower case character? ...

About "Replacement Text Case Conversion" learn from there ...  
[http://www.regular-expressions.info/replacecase.html](http://www.regular-expressions.info/replacecase.html)

DD.20160620.2044.CEST

---

<div class="post-metadata">

**Author:** ![Rijkstra](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rijkstra/32/22_2.png) [@Rijkstra](https://community.mp3tag.de/u/Rijkstra)\
**Post date:** [June 20, 2016, 5:49pm UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050/6 "2016-06-20T17:49:30Z")

</div>

> [@DetlevD](#):
>
> About "Replacement Text Case Conversion" learn from there ...  
> [http://www.regular-expressions.info/replacecase.html](http://www.regular-expressions.info/replacecase.html)
> 
> DD.20160620.2044.CEST

It's the best reference I have found also. I never had a need for that section. Thanks!

---

<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:26pm UTC](https://community.mp3tag.de/t/bug-when-replacing-regular-expressions/18050/7 "2026-02-09T12:26:18Z")

</div>

Closed on February 9, 2026, 12:26pm UTC


