I am trying to write a regex that extracts part of a subdomain / domain URL as separate lines.
I tried this:
/^[^:]+:\/\/([^\.\/]+)(\.[^\.\/]+)+(?:\/|$)/
It should work against these URLs:
http;//www.mail.yahoo.co.uk/blah/blah
http;//test.test.again.mail.yahoo.com/blah/blah
I want to break it into pieces like this:
["http://", "www", ".mail", ".yahoo", ".co", ".uk"]
["http://", "test", ".test", ".again", ".mail", ".yahoo", ".com"]
Now I can only capture them as:
["http://", "www", ".uk"]
["http://", "test", ".com"]
Does anyone know how I can fix my regular expression?