add validate email method

This commit is contained in:
Reza Haidari .A 2017-11-15 10:57:19 +03:30 committed by 花裤衩
parent 35055c5e51
commit 1d4f12187f

View file

@ -31,3 +31,13 @@ export function validatAlphabets(str) {
return reg.test(str)
}
/**
* validate email
* @param email
* @returns {boolean}
*/
export function validateEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\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 re.test(email);
}