As I said:
You can do a RegEx search on "extract domain" and see if you can find a better Regex.
You can also post the URLs that failed and we can take a look.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EDIT:
Turns out we have exhaustively addressed this question before.
==There are NO perfect solutions.==
You can take a look at the below thread to see if there is a solution there you like better:
How to trim URL to root domain? .