目的
function checkHostName(str){
if ( str.match(/^[a-z0-9\-]*$/) == null) {
return false;
} else {
if (str.match(/^[a-z]/) == null) {
return false;
} else {
if (str.match(/[\-]$/) != null) {
return false;
} else {
return true;
}
}
}
}