in reply to Re: Matching RFC1912 compliant hostnames
in thread Matching RFC1912 compliant hostnames
Note that while this matches 1912 hostnames, some newer hostnames have been belatedly declared "valid" though they do not adhere to this RFC (specifically, domains like 411.com or 800.com, which violate the "labels must not be all numbers" rule). Perhaps there is a newer RFC that supercedes 1912?my $alpha = 'a-zA-Z'; my $alphanum = $alpha.'\d'; my $any = $alphanum.'-'; my $label = qr/ (?:[$alpha]| # start with a letter \d[$any]*[$alpha]+) # or a number if there's a letter + elsewhere (?: [$any]* # followed by more stuff maybe [$alphanum] # as long as it doesn't end with +a - )? /x; $is_valid = /^(?:$label\.)*$label$/;
Perhaps somebody has a better solution...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Matching RFC1912 compliant hostnames
by fundflow (Chaplain) on Nov 18, 2000 at 06:24 UTC |