4 lines
144 B
JavaScript
4 lines
144 B
JavaScript
export function isValidHostname(hostname) {
|
|
const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;
|
|
return hostPattern.test(hostname);
|
|
}
|