Reworking of a half-working code

So I have this two codes

Format value: "TITLE": $regexp(%TITLE%,'(\[.*?\])','\U$1\E')and
Format value "TEMPORARY": $regexp(%TITLE%,'^(.*?)(\[.*?\])(.*?)$','$2')
Format value "TEMPORARY": $regexp(%TEMPORARY%,'\s+',)
Format value "TEMPORARY": $regexp(%TITLE%,'^(.*?)(\[.*?\])(.*?)$','$1'%TEMPORARY%'$3')
Format value "TEMPORARY": $char(0)

The first action changes any small letters into capital ones that are in placed in brackets; even when there are many instances of [] throughout the TITLE tag value

And the second action removes any spaces between any kind of characters in brackets; but only in the first instance of them

[Both tasks are independent of each other]

So how is the second code need to be reworked, based on the first one, so that it also would apply itself to infinite number of brackets? For example it should change this

Song Aaa [ x ] (Instrumental) + Song Bbb {2000 Mix} [Y2 ] vs. Song Ccc [ xYZ 9- 110]not merely to this
Song Aaa [x] (Instrumental) + Song Bbb {2000 Mix} [Y2 ] vs. Song Ccc [ xYZ 9- 110]but precisely into this
Song Aaa [x] (Instrumental) + Song Bbb {2000 Mix} [Y2] vs. Song Ccc [xYZ9-110]?

Use a positive lookahead :slight_smile: This action will replace all those you have currently.

$regexp(%title%,'\s+(?=[^[\]]*\])',)

DAMN! I've got to 666 posts. That's better!!

Are you a magician or something?

Thank you very much

No, it's 667 now

:sorcerer:

If you have 30$ lying around try Regexbuddy. https://www.regexbuddy.com/buynow.html

Amazing tool to learn the ins and outs of regular expression and to build them also.

Yeah it was that when I posted that. :wink: