Cool script, Zsolt! FWIW the URL you're parsing there is the "fully qualified" version, but you might find it easier to parse (or just use…) the simpler format:

sonar-app://open?repo=myrepo&task=123

Ofc this assumes you only have a single added repo with the given name, but I'm guessing that would be true in the vast majority of cases.