SonarQube is probably getting tripped up on the / in your regex. You can see why on https://regex101.com/ if you paste in the expression you’re trying to use.
I would recommend escaping the slash like this:
(master|release\/).*
On a separate topic, out of curiosity, why override the sonar.branch.name parameter? The extension/task should do a good job figuring that all out on its own.