helpers/email-validator.js

7 lines
294 B
JavaScript
Raw Normal View History

2022-10-29 22:05:19 +02:00
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;
}