Not quite. This is the idea - I need a quick hand:
code?(?<domain>[a-z]{3,}.){1}(?<tld>[a-z]{2,3}){1}(?<tld2>.[a-z]{2,3})?[/code]
This regexp will match as follows:
subdomain.google.com
subdomain => subdomain.
domain => google.
tld => com
Which is good!
subdomain.google.co.uk
subdomain => subdomain.
domain => google.
tld => co
tld2 => .uk
Also great!
google.com
subdomain => google.
tld => com
Not so great, google should be in domain.
google.co.uk
subdomain => google.
tld => co
tld2 => .uk
Gets the TLDs right, but still screws up the subdomain
google.com.uk
subdomain => google.
domain => com.
tld => uk
Now it's completely out to lunch!
I hope someone can see what I am trying to achieve and help me correct my regexp!
Thanks again.