Capital correction in brackets

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?

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

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

DD.20150921.2111.CEST

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

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

DD.20150921.2129.CEST, DD.20150922.0942.CEST

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

Unfortunately, this also produces the same errors

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

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]

Yes, sorry.

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.... :wink:

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

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

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]
see bad characters

The attached picture shows the result, which you have wanted in your yesterday post.


DD.20150922.2222.CEST


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