reg-dom-libs are a set of libraries for
Perl to convert an arbitrary domain name to the registered domain name.
- for simple domains, like
news.ycombinator.com, the task is trivial.
- for more complicated ones, like
http://www.japantimes.co.jp, handling the second level subdomain is a little painful.
- for exoteric ones, like
公司.cn, the problem becomes virtually impossible.
- after seeing stupid ones, like
http://www.comune.caserta.it(believe it or not, the registered domain is
comune.caserta.it!), I gave up finding an elegant algorithm for the problem.
- a full list of valid registered domain is necessary. luckily, it is available (and nightly updated) here.
a demo is availble here.