Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For comparison GPT-4 provides the following Python regex and then warns that it does not catch all edge cases and that it’s better to use a dedicated library like email-validator:

email_pattern = r"^(?=.{1,256})(?=.{1,64}@.{1,255}$)(?=\S)(?:(?!@)[\w&'+._%-]+(?:(?<!\\)[,;])?)(?<=\S)@((?=\S)(?!-)[A-Za-z0-9-]{1,63}(?<!-)\.?)+[A-Za-z]{2,19}(?<=\S)$"



I would say either that or just have a basic check that there is an @ somewhere.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: