Click here to get back home

subdomain.domain.tld regexp?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
subdomain.domain.tld regexp? John Bokma 03-24-2005
Get Chitika Premium
Posted by John Bokma on March 24, 2005, 6:58 am
Please log in for more thread options


Is there a module that can split a given host in a subdomain, domain, tld
part?

e.g.

www.google.com => www google com
www.google.co.uk => www google.co uk
www.google.nl => www google nl
www.asus.com.tw => www asus.com tw

(yup, technically the com? is probably the domain, and www a sub-sub
domain)

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html



Posted by Brian McCauley on March 24, 2005, 9:15 am
Please log in for more thread options




John Bokma wrote:

> Is there a module that can split a given host in a subdomain, domain, tld
> part?
>
> e.g.
>
> www.google.com => www google com
> www.google.co.uk => www google.co uk
> www.google.nl => www google nl
> www.asus.com.tw => www asus.com tw
>
> (yup, technically the com? is probably the domain, and www a sub-sub
> domain)

DNS is strictly hierachical. As far as DNS is concerned 'uk', 'co.uk',
'google.co.uk' and 'www.google.co.uk' are all just domains.

You need to take a step back and consider what you really want to do. I
suspect you have no idea.

To split a dot-delimited string into a list of components:

my @components = split /./, $domain_name;

Do you perhaps want to find the DNS zone boundries? If so why do you
think this would be helpful?




Posted by John Bokma on March 24, 2005, 5:53 pm
Please log in for more thread options


Brian McCauley wrote:

> John Bokma wrote:
>
>> Is there a module that can split a given host in a subdomain, domain,
>> tld part?
>>
>> e.g.
>>
>> www.google.com => www google com
>> www.google.co.uk => www google.co uk
>> www.google.nl => www google nl
>> www.asus.com.tw => www asus.com tw
>>
>> (yup, technically the com? is probably the domain, and www a sub-sub
>> domain)
>
> DNS is strictly hierachical. As far as DNS is concerned 'uk',
> 'co.uk', 'google.co.uk' and 'www.google.co.uk' are all just domains.

Yeah I know.

> You need to take a step back and consider what you really want to do.
> I suspect you have no idea.

Because you don't have an idea doesn't mean I haven't one.

I want to get the part one can register as, say, a company.

in the uk I can't register

somename.uk

but I can register:

somename.co.uk

In nl however, I can register:

somename.nl

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html



Posted by Brian McCauley on March 25, 2005, 9:40 am
Please log in for more thread options




John Bokma wrote:

> Brian McCauley wrote:
>
>
>>John Bokma wrote:
>>
>>
>>>Is there a module that can split a given host in a subdomain, domain,
>>>tld part?
>>>
>>>e.g.
>>>
>>>www.google.com => www google com
>>>www.google.co.uk => www google.co uk
>>>www.google.nl => www google nl
>>>www.asus.com.tw => www asus.com tw
>>>
>>>(yup, technically the com? is probably the domain, and www a sub-sub
>>>domain)
>>
>>DNS is strictly hierachical. As far as DNS is concerned 'uk',
>>'co.uk', 'google.co.uk' and 'www.google.co.uk' are all just domains.
>
>
> Yeah I know.
>
>
>>You need to take a step back and consider what you really want to do.
>>I suspect you have no idea.
>
> Because you don't have an idea doesn't mean I haven't one.

No, but the fact that your OP does not convey your idea is often a good
sign that you haven't actually crystalised your idea.

> I want to get the part one can register as, say, a company.

This is a question about the policy of issuing subdomains under a
domain. There may or may not be a standard way for a domain to publish
its subdomain policy. There certainly is no widely used standard.
If there were a widely used standard then there could be a Perl module
to interface to it.

> in the uk I can't register
>
> somename.uk

You can't, but some entities can. Sufficiently few uk 2nd-LDs are
issued I suspect each application is considered on it's merits rather
than there being a simple algotithm.

There are also domains like ac.uk which accept registrations from a
restricted class of entities.

Someone could compose a list of domains that accept subdomain
registration from the general populace but this could simply be a plain
text file rather than a Perl module.

Note: there are situations like uk.com where both uk.com and com accept
registrations.



Similar ThreadsPosted
ANNOUNCE: Regexp::Common::time December 8, 2005, 6:20 am
Module Submission: Regexp::MultiLanguage June 22, 2006, 1:53 pm
Determine NT domain username of web client February 3, 2005, 4:24 pm
Looking for module that will expands domain/username to email address October 23, 2004, 12:56 am
checking userid and password against windows domain (Active directory) June 9, 2005, 10:57 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap