# Capital correction in brackets

**URL:** <https://community.mp3tag.de/t/capital-correction-in-brackets/17253>\
**Category:** Support\
**Created:** [September 21, 2015, 3:14pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253 "2015-09-21T15:14:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)\
**Post date:** [September 21, 2015, 3:14pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/1 "2015-09-21T15:14:09Z")

</div>

Some time ago I was given here a code like this

```
Format value: "TITLE": $regexp(%TITLE%,'(\[.*\])',\U$1)

```

And now I see it has flaw. Because something like this  
**Title 1 [xxx] + Title 2**  
is correctly changed to  
**Title 1 [XXX] + Title 2**  
but  
**Title 1 [xxx] + Title 2 [yyy]**  
is incorrectly changed to  
**Title 1 [XXX] + TITLE 2 [YYY]**  
instead of being changed to  
**Title 1 [XXX] + Title 2 [YYY]**

Apparently the code sees the second \>\>]\<\< and so ignores the first \>\>]\<\< and second \>\>[\<\<

So my question is: how to change it, so it will stop executing itself after each \>\>]\<\< and start again after another \>\>[\<\<?

And also: how can I find now all the CAPITALIZED TITLES?

---

<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:** [September 21, 2015, 5:00pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/2 "2015-09-21T17:00:23Z")

</div>

The "flaw" could only orginate from an insufficient specification of the pattern that should be dealt with by the regular expression.  
I bet that you only supplied one pair of brackets.  
Try this:  
Format value: "TITLE": $regexp(%TITLE%,'([._])( ._ )([.\*])',\U$1$2\U$3)

You could look for capitals only tracks e.g. with this:

$if($strcmp(%title%,$upper(%title%)),1,0) IS 1

---

<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:** [September 21, 2015, 5:10pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/3 "2015-09-21T17:10:38Z")

</div>

> [@zerow](#):
>
> Some time ago I was given here a code like this ... And now I see it has flaw. ... Apparently the code ... So my question is: how to change it ...

If a regular expression behaves too _greedy_, then make the expression _lazy_ ...

**$regexp('Title 1 [xxx] + Title 2 [yyy]','(\[.\*?]\])','\U$1\E')**

From:  
Title 1 [xxx] + Title 2 [yyy]  
To:  
Title 1 [XXX] + Title 2 [YYY]

See also ...  
[http://www.regular-expressions.info/repeat.html](http://www.regular-expressions.info/repeat.html)

DD.20150921.2111.CEST

---

<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:** [September 21, 2015, 5:29pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/4 "2015-09-21T17:29:33Z")

</div>

> [@zerow](#):
>
> ... And also: how can I find now all the CAPITALIZED TITLES?

TITLE \<== 'ALL TEXT CAPITALIZED'  
TITLE MATCHES "(?-i)\[1\]+$"

... or ...  
TITLE \<== 'Title 1 [XXX] + TITLE 2 [YYY]'  
TITLE MATCHES "(?-i)^.\*[\u+]$"

DD.20150921.2129.CEST, DD.20150922.0942.CEST

* * *

1. \u\s

---

<div class="post-metadata">

**Author:** ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)\
**Post date:** [September 22, 2015, 3:26pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/5 "2015-09-22T15:26:04Z")

</div>

> [@ohrenkino](#):
>
> The "flaw" could only orginate from an insufficient specification of the pattern that should be dealt with by the regular expression.  
> I bet that you only supplied one pair of brackets.

I bet too

But I don't know how I apparently just forgot to test it on more complicated titles, with more than one brackets

> [@ohrenkino](#):
>
> Try this:  
> Format value: "TITLE": $regexp(%TITLE%,'([._])( ._ )([.\*])',\U$1$2\U$3)  
> [...]

Unfortunately, this also produces the same errors

> [@DetlevD](#):
>
> If a regular expression behaves too greedy, then make the expression lazy ...
> 
> **$regexp('Title 1 [xxx] + Title 2 [yyy]','(\[.\*?\])','\U$1\E')**

...eee am I suppose to write down every time the content that is before brackets?

> [@DetlevD](#):
>
> See also ...  
> [http://www.regular-expressions.info/repeat.html](http://www.regular-expressions.info/repeat.html)
> 
> DD.20150921.2111.CEST

If the problem is the plus sign, that I use when I have more than one song in a file, I could workaround it by replacing it to some other sign or signs before running the main code [and replacing them back after doing so]

---

<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:** [September 22, 2015, 3:52pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/6 "2015-09-22T15:52:24Z")

</div>

> [@zerow](#):
>
> ...Unfortunately, this also produces the same errors..

Yes, sorry.

> [@](#):
>
> ...eee am I suppose to write down every time the content that is before brackets?

No, the $regexp can either have a string constant or a field variable as input. In this case DetlevD chose the string constant as one does not always want to mess up one's track tags.... 😉

You can test this $regexp in the Convert\>Tag-Tag function.

---

<div class="post-metadata">

**Author:** ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)\
**Post date:** [September 22, 2015, 5:38pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/7 "2015-09-22T17:38:23Z")

</div>

> [@zerow](#):
>
> [...]  
> ...eee am I suppose to write down every time the content that is before brackets?  
> [...]

> [@ohrenkino](#):
>
> [...]  
> No, the $regexp can either have a string constant or a field variable as input. In this case DetlevD chose the string constant as one does not always want to mess up one's track tags.... 😉  
> [...]

```
Format value "TITLE"
$regexp('%TITLE%','(\[.*?\])','\U$1\E')still goes too far, not seeing the end of first bracket

```

And if there is nothing more after the \>\>]\<\<, it just puts

```
%TITLE%in the TITLE tag

```

> [@ohrenkino](#):
>
> The "flaw" could only orginate from an insufficient specification of the pattern that should be dealt with by the regular expression.  
> [...]

And to prevent further flaws: there can be also other brackets in the TITLE

```
(
)
{
}But they are [no mater what kind] newer inside other brackets, only sometimes next to each other; for example:
Title A (Sub Title) {2000 Mix} [XXX] + Title B {Club Remix} [YYY] + Title C (Instrumental) [ZZZ][So this is probably irrelevant]

```

---

<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:** [September 22, 2015, 6:22pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/8 "2015-09-22T18:22:41Z")

</div>

> [@zerow](#):
>
> $regexp( **'** %TITLE% **'** ,'([.\*?])','\U$1\E')[/code]still goes too far, not seeing the end of first bracket ...

> > > see bad characters

The attached picture shows the result, which you have wanted in your yesterday post.  
 ![](https://community.mp3tag.de/uploads/default/original/2X/0/0c60560c6368b0bb543f3040ec2240d859f94062.png)  
  
DD.20150922.2222.CEST

![](https://community.mp3tag.de/uploads/default/original/2X/0/0c60560c6368b0bb543f3040ec2240d859f94062.png)

---

<div class="post-metadata">

**Author:** ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)\
**Post date:** [September 22, 2015, 7:08pm UTC](https://community.mp3tag.de/t/capital-correction-in-brackets/17253/9 "2015-09-22T19:08:59Z")

</div>

> [@DetlevD](#):
>
> The attached picture shows the result, which you have wanted in your yesterday post.

Yes. I've tested this even further and also for \_FILENAME; and it seems to work 100%

The problem was, As you pointed it out, bad characters; in the form of unnecessary use of

```
''

```

for

```
%TITLE%

```

which comes from my lack of experience

So once again thank you both for the much needed help and info

---

<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/capital-correction-in-brackets/17253/10 "2026-02-09T12:25:53Z")

</div>

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


