helpers/email-validator.js
2022-10-29 22:05:19 +02:00

7 lines
294 B
JavaScript

export const validateEmail = (control, value) => {
if (typeof value !== 'string') {
return false;
}
return value.toLowerCase().match(/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/) !== null;
}