幾つかの条件をjsで判定
function validSubDomainP(subdomain) {
if (subdomain.length < 3 || subdomain.length > 63) {
return false; // too long or too short
}
else if (!subdomain.match(/^[a-zA-Z0-9\-]+$/)) {
return false; // container illegal characters
}
else if (subdomain.match(/(^-|-$)/)) {
return false; // begins with - or ends with -
}
else if (subdomain.match(/^[a-zA-Z][a-zA-Z]--/)) {
return false; // xx-xxxx is not permitted.
}
else {
return true;
}
};