blob: 6a2c3bdca8fb2cf4f92ced501ce5bb12465ec85f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { FormControl } from '@angular/forms';
export function validateEmail(c: FormControl) {
// Thanks to http://emailregex.com/
/* tslint:disable */
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,}))$/;
return EMAIL_REGEXP.test(c.value) ? null : {
email: {
valid: false
}
};
}
|