diff options
Diffstat (limited to 'client/src/app/shared/forms/form-validators/host.validator.ts')
-rw-r--r-- | client/src/app/shared/forms/form-validators/host.validator.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/form-validators/host.validator.ts b/client/src/app/shared/forms/form-validators/host.validator.ts new file mode 100644 index 000000000..9cb46d361 --- /dev/null +++ b/client/src/app/shared/forms/form-validators/host.validator.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | import { FormControl } from '@angular/forms'; | ||
2 | |||
3 | export function validateHost(c: FormControl) { | ||
4 | let HOST_REGEXP = new RegExp('^(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$'); | ||
5 | |||
6 | return HOST_REGEXP.test(c.value) ? null : { | ||
7 | validateHost: { | ||
8 | valid: false | ||
9 | } | ||
10 | }; | ||
11 | } | ||