]>
Commit | Line | Data |
---|---|---|
e600e1fe | 1 | export function validateHost (value: string) { |
447fde27 | 2 | // Thanks to http://stackoverflow.com/a/106223 |
ad4a8a1c | 3 | const HOST_REGEXP = new RegExp( |
447fde27 | 4 | '^(([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])$' |
df98563e | 5 | ) |
49abbbbe | 6 | |
e600e1fe | 7 | return HOST_REGEXP.test(value) |
49abbbbe | 8 | } |