wazoox has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking for a way to validate the hostname of a machine in a system installation script. I've looked thru RFC1034 and it's pretty simple (see below), however I couldn't find a module that would explicitly validate hostnames and domain names accordingly. Does anyone knows if such a module exists ?
digest of RFC 1034: fully qualified hostname are up to 255 bytes long. They're made of labels which are up to 63 bytes long. Each label can contains letters, digits and - (minus) exclusively, and should start and end with a letter or number (RFC1034 pretends it should start with letters only, however domain names such as http://42.com do exist and are necessarily valid). Labels are separated by dots ( . ).
All of this could be made into a regexp quite easily. I hardly believe it hasn't be already done somewhere by someone :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to validate a (not yet existing) hostname
by McDarren (Abbot) on Jun 13, 2006 at 10:58 UTC | |
by wazoox (Prior) on Jun 13, 2006 at 12:40 UTC |