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,}))$/ const parseResult = (val?: string) => val && emailRegex.test(val) ? `${val}` : val ?? '' export const newLeadEmailContent = ( resultUrl: string, answers: { [key: string]: string } ) => `
${Object.keys(answers) .map( (key) => `` ) .join('')}
Your typebot has collected a new lead! 🥳
${key}: ${parseResult( answers[key] )}
`