mirror of
https://gitlab.com/comunic/comunicconsole
synced 2025-03-14 18:22:38 +00:00
12 lines
319 B
TypeScript
12 lines
319 B
TypeScript
|
/**
|
||
|
* String utilities
|
||
|
*
|
||
|
* @author Pierre Hubert
|
||
|
*/
|
||
|
|
||
|
export function validateEmail(email: string) {
|
||
|
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(String(email).toLowerCase());
|
||
|
}
|