URI matching preference order

Your pseudo-code suggests that what you are really requesting is for Bitwarden to create a sorted list of all services for which you have accounts in a given web domain thread (sorted by specificity of the URI match). If that’s the case, you should vote in another feature request thread: Base domain versus host: best of both worlds.

However, you also wrote the following about a proposed URI matching behavior:

Thus, according to your description above, it seems that you want the sub.corp.com credentials (vault item) to match when you visit sub.corp.com, and when you visit x.corp.com, but not when you visit voice.corp.com, is that correct?

Incidentally, your pseudo-code does not implement such behavior (all three vault items would always be matched when you visit any corp.com webpage, but the sort order would change).