The problem is that your regular expression isn't accounting for IPv6 numeric addresses (not that I'd recommend their use in the first place; it's wise to use DNS to bind them to a name in production use).
To examine how things are failing, let's adapt the RE slightly to capture a bit more:
([^:]+)://([^:/]+)(:[0-9]+)?(/?)
In this version, everything that isn't utterly fixed is captured. Now let's test it against your use cases with regexp -inline (the -inline option makes regexp return the matched substrings, which is great for debugging REs, and it really helps to put the RE in a variable and use it like below as that makes it easier to avoid typos):
% set RE {([^:]+)://([^:/]+)(:[0-9]+)?(/?)} ([^:]+)://([^:/]+)(:[0-9]+)?(/?) % regexp -inline $RE {https://10.77.56.89} https://10.77.56.89 https 10.77.56.89 {} {} % regexp -inline $RE {https://[2001:1:1:43::115]/ucmuser} {https://[2001:1} https {[2001} :1 {}
We see that the [^:]+ part is the problem, as it is stopping at the first colon in the IPv6 address. We need to add a special case when the first part of the hostname begins with [; we won't do full validation (check the ip package in Tcllib if you want that) but we can do some simple stuff by checking that the contents of the brackets are hex digits or colons.
% set RE {([^:]+)://([^]:[/]+|\[[0-9a-f:A-F]+\])(:[0-9]+)?(/?)} ([^:]+)://([^]:[/]+|\[[0-9a-f:A-F]+\])(:[0-9]+)?(/?) % regexp -inline $RE {https://10.77.56.89} https://10.77.56.89 https 10.77.56.89 {} {} % regexp -inline $RE {https://[2001:1:1:43::115]/ucmuser} {https://[2001:1:1:43::115]/} https {[2001:1:1:43::115]} {} /
That looks right to me (yes, it took a little tinkering to get the syntax right because of the interactions with the syntax for POSIX RE character classes). Converting to have the same capturing groups that you originally had, your RE should be this:
[^:]+://(?:[^]:[/]+|\[[0-9a-f:A-F]+\])(:[0-9]+)?/?
(NB: We're using a non-capturing parenthesis, (?:…), in this because we need alternation, |, between two sub-REs.)