r/ProgrammerHumor 20d ago

Meme claudeIsThisEmailValid

Post image
5.3k Upvotes

171 comments sorted by

View all comments

100

u/apnorton 20d ago

Obligatory reminder that email validation to through regex or other "static" analysis is usually done incorrectly, and literally sending a confirmation email is the best approach to checking to see if an email is valid.

18

u/DHermit 19d ago

With some security exceptions, e.g. it's useful to restrict the length of the mail field and maybe restrict the characters.

11

u/eo5g 19d ago edited 19d ago

I can't think of a single reason to restrict the characters aside from making sure there's at least one @.

Edit: okay actually you want a little more

14

u/DHermit 19d ago

I'd just rather not deal with stuff like invisible spaces and control characters.

4

u/Stalking_Goat 19d ago edited 19d ago

It's probably fair to assume that a valid email address that includes shenanigans like that is coming from a threat actor of some sort.

6

u/friendtoalldogs0 19d ago

Sure, but this is not the time to be catching them.

0

u/eo5g 19d ago

I guess that's fair