# How to make Grammartron ignore text within \[brackets\] ?

**URL:** <https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266>\
**Category:** Support\
**Created:** [October 27, 2014, 1:31am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266 "2014-10-27T01:31:27Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 27, 2014, 1:31am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/1 "2014-10-27T01:31:27Z")

</div>

With a little tweaking I've been able to adapt Grammartron to suit my needs pretty well, except that many of my files have descriptive elements within brackets that I don't want capitalized, such as "Song Title [alt take 1]". I can write a script to lowercase a string within brackets, but if I happen to re-run Grammartron afterwards it will capitalize those strings and I'll have to lowercase them all over again, so I'd like to modify Grammartron to ignore text within brackets. Unfortunately, my regex skills are not up to snuff. Can anyone help me out?

---

<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:** [October 27, 2014, 7:41am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/2 "2014-10-27T07:41:56Z")

</div>

> [@spongeAvenger](#):
>
> .. so I'd like to modify Grammartron to ignore text within brackets. ..

Could you tell us which expression from within Grammartron capitalizes after the square brackets?

The alternative would be to add an action to the Grammartron (?!) the de-capitalizes the expression in square brackets. Would probably be easier to write and maintain as it does not mess with the original action.

---

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 27, 2014, 10:45am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/3 "2014-10-27T10:45:00Z")

</div>

> [@ohrenkino](#):
>
> Could you tell us which expression from within Grammartron capitalizes after the square brackets?

This seems to be the main action:

[#17]  
T=4  
! Title Case Conversion [1] (Convert Words to Mixed-Case, Ignoring Upper-Case Letters)=  
F=\_TAG  
1=([-({\\[\\]}) \_",./+&@:;\*])(\\l)  
2=$1$upper($2)  
3=1

> [@ohrenkino](#):
>
> The alternative would be to add an action to the Grammartron (?!) the de-capitalizes the expression in square brackets. Would probably be easier to write and maintain as it does not mess with the original action.

Yes, I could do that, but it wouldn't be ideal because there might be instances when I would not want everything within the brackets lower-case. For example: "Song Title [US version]".

---

<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:** [October 27, 2014, 11:44am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/4 "2014-10-27T11:44:48Z")

</div>

> [@](#):
>
> ... it wouldn't be ideal because there might be instances when I would not want everything within the brackets lower-case. For example: "Song Title [US version]".

Now you have lost: as MP3tag cannot read and does not speak English, it cannot tell if the case is OK or not.  
You would have to device a list of exceptions to the rule. Like US.

As for the action:  
I think  
1=([-({\\[\\]}) \_",./+&@:;\*])(\\l)

should become

1=([-({\]}) \_",./+&@:;\*])(\\l)

---

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 27, 2014, 10:44pm UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/5 "2014-10-27T22:44:07Z")

</div>

Thanks for your help, that seems to work. I gave it a quick test, but I'll test it more thoroughly later. Can you help me with another problem that popped up? I wrote this action to lowercase any text within parentheses and replace the parentheses with brackets:

[#0]  
T=4  
! Replace (Text String) with [Text String]=  
F=TITLE  
1=\\((.+)\\)  
2=[$lower($1)]  
3=1

It usually works, except when the text string includes a comma. For example, "Air Mail Special (Stratford, Ontario Jazz Festival)" becomes "Air Mail Special [stratford]".

---

<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:** [October 28, 2014, 9:06am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/6 "2014-10-28T09:06:26Z")

</div>

> [@spongeAvenger](#):
>
> ...  
> [#0]  
> T=4  
> ! Replace (Text String) with [Text String]=  
> F=TITLE  
> 1=\\((.+)\\)  
> 2=[$lower($1)]  
> 3=1  
> ...

If I apply that action (Replace with regular expression) then the string "Air Mail Special (Stratford, Ontario Jazz Festival)" stays absolutely the same. Nothing left out, no case conversion, no replacement.

---

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 28, 2014, 11:05am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/7 "2014-10-28T11:05:55Z")

</div>

> [@ohrenkino](#):
>
> If I apply that action (Replace with regular expression) then the string "Air Mail Special (Stratford, Ontario Jazz Festival)" stays absolutely the same. Nothing left out, no case conversion, no replacement.

Then you're doing something wrong.

---

<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:** [October 28, 2014, 11:58am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/8 "2014-10-28T11:58:38Z")

</div>

> [@spongeAvenger](#):
>
> Then you're doing something wrong.

I only get the same result as you if I use  
((.+))  
instead of  
\\((.+)\\)

Actually, I am not sure if the "lower" and "upper" functions still work properly.  
If you use them in the tag-tag-converter as $regexp() then the preview does not show any changes to the orginal string....  
So I am not sure if the $upper() etc. functions actually use the comma as string separator.

---

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 28, 2014, 7:49pm UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/9 "2014-10-28T19:49:29Z")

</div>

> [@ohrenkino](#):
>
> I only get the same result as you if I use  
> ((.+))  
> instead of  
> \\((.+)\\)

If you copy/paste \\((.+)\\) into Actions or Actions (Quick) mp3Tag will add additional backslashes, which is probably why it wasn't matching anything. If you copy/paste my code directly into a .mta file in the actions folder, then run the action, it should work as I've described.

> [@ohrenkino](#):
>
> Actually, I am not sure if the "lower" and "upper" functions still work properly.  
> If you use them in the tag-tag-converter as $regexp() then the preview does not show any changes to the orginal string....  
> So I am not sure if the $upper() etc. functions actually use the comma as string separator.

I don't understand why it would be looking for string separators when it is only supposed to be working on a title tag. Can you think of an alternate method to lowercase text within brackets?

---

<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:** [October 28, 2014, 8:05pm UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/10 "2014-10-28T20:05:58Z")

</div>

> [@spongeAvenger](#):
>
> ... Can you think of an alternate method to lowercase text within brackets?

I tried  
$regexp(%title%,((.\*)),'\L[$1]')  
and that works

---

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 28, 2014, 9:37pm UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/11 "2014-10-28T21:37:52Z")

</div>

> [@ohrenkino](#):
>
> I tried  
> $regexp(%title%,((.\*)),'\L[$1]')  
> and that works

Thanks, but I'm only familiar with using the Actions format and I don't know how/where to use this script. The Help pages are not very helpful in that regard. Does this script work in an Actions .mta file?

---

<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:** [October 28, 2014, 9:43pm UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/12 "2014-10-28T21:43:22Z")

</div>

> [@spongeAvenger](#):
>
> Thanks, but I'm only familiar with using the Actions format and I don't know how/where to use this script. The Help pages are not very helpful in that regard. Does this script work in an Actions .mta file?

You can enter the $regexp() as the format string in a "Format value" action.  
Or you separate the 3 parts of the expression as the items for a "Replace with regular expression" action.

---

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 28, 2014, 10:46pm UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/13 "2014-10-28T22:46:49Z")

</div>

> [@ohrenkino](#):
>
> You can enter the $regexp() as the format string in a "Format value" action.  
> Or you separate the 3 parts of the expression as the items for a "Replace with regular expression" action.

Vielen Dank. I got that to work as a "Format value" action. However, when I modified it to lowercase text within brackets instead of parentheses, like so,

$regexp(%title%,[(.\*)],'\L[$1]')

... I get an error:

REGEXP ERROR: Regular expression  
Incomplete escape sequence found. The error occurred while parsing the regular expression: '\>\>\>HERE\>\>\>'.

---

<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:** [October 29, 2014, 7:12am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/14 "2014-10-29T07:12:58Z")

</div>

> [@spongeAvenger](#):
>
> Vielen Dank. I got that to work as a "Format value" action. However, when I modified it to lowercase text within brackets instead of parentheses, like so,
> 
> $regexp(%title%,[(.\*)],'\L[$1]')
> 
> ... I get an error:
> 
> REGEXP ERROR: Regular expression  
> Incomplete escape sequence found. The error occurred while parsing the regular expression: '\>\>\>HERE\>\>\>'.

Try it with more apostrophes:  
$regexp(%title%,'[(.\*)]','\L[$1]')

---

<div class="post-metadata">

**Author:** ![spongeAvenger](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@spongeAvenger](https://community.mp3tag.de/u/spongeAvenger)\
**Post date:** [October 29, 2014, 8:24am UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/15 "2014-10-29T08:24:47Z")

</div>

Thanks again.

---

<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:25pm UTC](https://community.mp3tag.de/t/how-to-make-grammartron-ignore-text-within-brackets/16266/16 "2026-02-09T12:25:20Z")

</div>

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


