1 import { FormControl } from '@angular/forms';
3 export function validateHost(c: FormControl) {
4 // Thanks to http://stackoverflow.com/a/106223
5 const HOST_REGEXP = new RegExp(
6 '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$'
9 return HOST_REGEXP.test(c.value) ? null : {