@Zvoni:
Though my solution is far from perfect as proofed by your examples, that is one heck of an expression and still fails when the protocol name has a capital letter. Thus casting to low or high for checking the protocol is preferred (I know that can (easily) be added to the expression as well

).
If you really want to do it properly then
ParseURI and
EncodeURI is imho far more understandable (though I do admit that when using RE's is something that you do every day you probably read/write it as a normal person would read/write text is his/her native tongue -> I honestly can't).