Yeah, that's the tricky part. For easy stuff like the provided sample (http://www.google.com/xyz) something like this should work:
^(?:.*://)?(?:www\.)?([^:/]*).*$
This should cover URLs like:
- http://www.google.com/xyz
- www.google.com/xyz
- google.com/xyz
- www.google.com
- http://google.com:8080/xyz
It will not work with subdomains other than "www" like in "files.google.com/xyz". To make a regex work with all kind of URLs it seems you need a complete list of TLDs (because of TLDs like "co.uk"). See also this post on Stackoverflow.
The best bet would probably be using perl with the URI module, or something similar.
Well, here is a macro with the aforementioned regex. It also does the Whois query and the conversion of the creation date to age:
[test] Get Domain Age.kmmacros (4.8 KB)
To test it paste your URL into the green action. To use the content of your clipboard paste %CurrentClipboard%
into the field.
Edit/PS:
If you do have to deal with subdomains other than "www" and you do not have TLDs consisting of two parts (co.uk etc.) then try this regex:
^(?:.*://)?(?:.*?\.)?([^:/]*?\.[^:/]*).*$
This handles URLs like
but it will fail with