7 lines
281 B
TypeScript
7 lines
281 B
TypeScript
const emailRegex =
|
|
/^(([^<>()[\]\\.,;:\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,}))$/
|
|
|
|
export const formatEmail = (email: string) => {
|
|
if (emailRegex.test(email)) return email.toLowerCase()
|
|
}
|