},
'hostname': function(v)
- { if ( v.length <= 253 )
- return (v.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) != null);
+ {
+ if (v.length <= 253)
+ return (v.match(/^[a-zA-Z0-9]+$/) != null ||
+ v.match(/^[a-zA-Z0-9][a-zA-Z0-9\-.]*[a-zA-Z0-9]$/) != null);
return false;
},
end
function hostname(val)
- if val and (#val < 254) and val.match(val, "^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$") then
+ if val and (#val < 254) and (
+ val:match("^[a-zA-Z0-9]+$") or
+ val:match("^[a-zA-Z0-9][a-zA-Z0-9%-%.]*[a-zA-Z0-9]$")
+ ) then
return true
end
return false