Because of this inherent hierarchical inconsistency in standard URI formats, my projects sometimes internally use a reordered variant of the URI we call 'SURT form'. For example:
The parentheses and commas make it absolutely clear that you're dealing with a reordered URI-authority-component.
Even the trailing comma and off-paren are significant in our most common use-case: determining whether a URI falls within a certain hierarchical collection-scope by making a simple prefix-comparison. Compare the prefixes:
The first would also accept < http://(com,googlepages, > URIs, while the second would accept all subdomains of < com,google, >, and the third accepts only URIs strictly on < com,google, > but not its subdomains.
http://(com,google,mail,)/sub/folder
The parentheses and commas make it absolutely clear that you're dealing with a reordered URI-authority-component.
Even the trailing comma and off-paren are significant in our most common use-case: determining whether a URI falls within a certain hierarchical collection-scope by making a simple prefix-comparison. Compare the prefixes:
http://(com,google
http://(com,google,
http://(com,google,)
The first would also accept < http://(com,googlepages, > URIs, while the second would accept all subdomains of < com,google, >, and the third accepts only URIs strictly on < com,google, > but not its subdomains.