Rocket.Chat.ReactNative/app/lib/methods/helpers/isValidEmail.ts

7 lines
291 B
TypeScript

export function isValidEmail(email: string): boolean {
/* eslint-disable no-useless-escape */
const reg =
/^(([^<>()\[\]\\.,;:\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 reg.test(email);
}