in reply to Fully Qualified Domain Name
To copmly with RFC 1123, I used what was posted here: http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address
Here's my subroutine for perl (seems to work nicely):
sub is_FQDN { my $testval = shift(@_); ( $testval =~ m/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9] +)\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/ ) ? return 1 : return 0; }
|
|---|