Regex: adapt target capitalization to the source? ("Adapt case" regex switch?)

I have an action group for translating italian musical terms to hungarian. Now i have hundreds of actions inside it, but it could be half, if to find a solution: target capitalization, corresponding to the source. I mean, if Allegro, translation will Gyorsan; if allegro, then gyorsan. Now i use:

[#64]
T=4
F=TITLE
1=\\bAllegro\\b
2=Gyorsan
3=1

[#65]
T=4
F=TITLE
1=\\ballegro\\b
2=gyorsan
3=1

Solution is exist, for example in JGSoft PowerGREP and EditPad. Does it exist in Mp3tag, too? I could not find the answer.

I can only think of a solution to reduce the amount of

with
$replace(%title%,Allegro,Gyrosan,allegro,gyrosan)
(and so on with numerous pairs like that)
I cannot think of a way to reduce the number of pairs. There is nothing to set "Keep case".

1 Like

Does this work by any chance?

$regexp(%title%,\b(A|a)llegro\b,$if(strcmp($1,$upper($1)),G,g)yorsan,1)
1 Like

Thank you, Ohrenkino and Crissov, for the quick help.

I forgot to notice: my goal is not the performance. As usually i rename 1 album at once, so despite the 650 actions in the group, the speed is right, some milliseconds. I am interesting, because i was waiting for some short, elegant solution with a regex switch, as here i got a help ten years ago.

I admit, the termin "Adapt case" regex switch (i mean: checkmark in the programs, not a real switch) i could find in google only in context with JGSoft programs (PowerGREP and EditPad), but there may be some other termin, i think.

The list of terms i expand often (for example today, carillon=harangjáték, at Bizet), so it simply will be easier to create one plus replace action (with duplication of an existing) in the group, than two. Crissov's solution must work, but it is, in my eyes, less transparent (while redacting the new row), than the existing 2-actions variant, because there are lines, like this:

[#52]
T=4
F=TITLE
1=\b(Allegro ([Aa]ss(ai|ez)|([Dd]i )*[Mm]olto))\b
2=Nagyon gyorsan
3=1

But it seems by Ohrenkino, there is no such regex switch:

By the way, the action group is here.