]>
Commit | Line | Data |
---|---|---|
ad4a8a1c C |
1 | import { FormControl } from '@angular/forms'; |
2 | ||
3 | export function validateEmail(c: FormControl) { | |
4 | // Thanks to http://emailregex.com/ | |
5 | /* tslint:disable */ | |
6 | const EMAIL_REGEXP = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
7 | ||
8 | return EMAIL_REGEXP.test(c.value) ? null : { | |
9 | email: { | |
10 | valid: false | |
11 | } | |
12 | }; | |
13 | } |