FTAYLOR wrote:According to which definition?
a.example.com & b.example.com
Both are local to example.com
Ok, you are looking at forums.sun.com right now.
The base domain name is sun.com.Says who? Why isn't it "com"? You use the term "base domain name" as if it had a well-defined meaning, when in fact it hasn't got one. So you need to either 1.) point us to some definition of the term that you are using or 2.) define the term yourself.
You could easily write a regular expression to determine if a domain name is valid or not, and this would require the set of rules you are talking about.I get the basic idea you are talking about. But that still doesn't define anything that can be put in code.
However, for my purposesWhat purpose is that? Since you didn't tell us what you want to achieve (or why), we can't tell you how to proceed.
, I do not think a rule set will be of any assistance as there are too many variables and no constants. I think I am going to need a full list of domain extensions.Then get that.
FTAYLOR wrote:No, that's not what you want, because according to this definition you expect the input "bbc.co.uk" to produce "co.uk".
Granted I was not very clear in my definition.
What I meant by a "base domain name" was the Second Level Domain as defined by the Domain Name System, but devoid of any further sub domains.
In my earlier example forums.sun.com, com is the Top Level Domain, sun is the Second Level Domain and forums is the Third Level Domain (of N Level Domains). As some Top Level Domains (normally country code Top Level Domains) often define their own Second Level Domain, sometimes it will be necessary for me to extract the Third Level Domain (again, devoid of any further N Level Domains).There's some nastiness even there: Austria has .at and there are tons of "foo.at" sites. But there's also ".ac.at" for universities and ".gv.at" for government sites. So there you'd need the precise list of ccSLDs to finish your task, not just the information that ".at" has "special" SLDs.
This task will be nigh on impossible without a list of all TLDs to work out when to use the Third Level Domain instead of the SLD.It is impossible without such a list.
malcolmmc wrote:Over my dead body :pkajbj wrote:It wants to be, though.malcolmmc wrote:eu isn't a country.
I can't think of a case, off the top of my head, where a two letter final component isn't a country code
Any more counter-examples to special-case?There seems to be more special cases. Ax (Top domain for Åland which belongs to Finland) isn't a country.
FTAYLOR wrote:Note that ax that I mentioned earlier can become a hube problem to you. ".ax" used to be "aland.fi", so e.g. peace.aland.fi is the same as peace.ax
Scotland is due to apply for the .scot ccTLD and Wales for the .cym ccTLD, so even if there are not currently three letter ccTLDs there soon will be.
@Joachim please check definition caveats in further sentences from the same paragraph prior to jumping to conclusions, and thanks for your help.