Weird behavior after applying regex

So I'm using this as an action "Replace with regular expression" to make all the text inside the brackets change to title case:

Field: TITLE
Regular expression: (.*)(\()(.*)(\))(.*)
Replace matches with: $1$2$caps2($3)$4$5

But if the text inside the brackets has any comma it gets all messed up.
For example MP3Tag turned this:

Papercut (live at Docklands Arena, London)

Into this:

Papercut (lIve At DoCklAndS ArenA)

And I don't understand what I'm doing wrong, all of that regex looks OK. Can someone help? All I can think of is that this is a bug.

Irrespective of your finding ...
(where I tried to find out what was going on with Converter>Tag-Tag and $regexp()- but that function produces a different result from the action)
I think it has to do with the greadiness of the function. Except for the brackets you do not supply any separator so that the expression can find out where one (.*) ends and the next one starts. Also, the supplied string is empty for $5 as nothing follows the closing bracket. This may be tolerable, I still see it as somewhat untidy.

In respect to the problem:
If you want to use the brackets as word boundary indicator why don't you use the case conversion action and add the opening bracket to the list of characters after which a letter gets capitalized. Here you can add further characters like punctuation, other brackets, hyphens etc.

I thought about that but I didn't know how to tell the engine that there is no separator, or how to escape the backreference, obviously enclosing it with quotes doesn't work. $5 is there because sometimes there is something like Title One (Live at XXXXXXX) [PepeLePew Remix] and I don't want to loose that last part of the title.

I tried that but as I said, sometimes there is still text after the last bracket and that action changes the case of everything after the selected character (first -opening- bracket). For most cases it works but I can't use that as an automated action.

If you expand the string, you can see that it's the result of applying $caps2(live at Docklands Arena, London), where the "second parameter" London is specifies the characters that trigger upper case.

You'd need to take care of those commas in your regular expression if you want to use $caps2() on the result.

Thanks for the info. Do you have any idea as to how can I achieve that?

Here's one idea:
Replace commas with something unique, apply the regex, then reverse the original replacement.

I have been using the unicode character U+201A "Single Low-9 Quotation Mark" as it looks virtually identical on-screen and does NOT interfere with any scripting or regex. I didn't even change it back. It is applied to all Title, Album, Artist, AlbumArtist, and Composer tags in my library. The hardest part is remembering this when adding new tags. In Windows you can use Alt+0130 as well.
Standard Comma ,
Single Low Quote ‚