I was thinking a Trie http:// en.wikipedia .org/wiki/Trie would be ideal, each node would contain a block of the URL. See image http:// i.imgur .com/BkAW8cl.png