2
0
Files
bot/packages/bot-engine/blocks/inputs/email/formatEmail.ts
Ankit 618322e13e ️ Format email input to lower case (#1520)
Closes #897

---------

Co-authored-by: Baptiste Arnaud <baptiste.arnaud95@gmail.com>
2024-05-21 12:13:10 +02:00

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()
}