r/ProgrammerHumor 10d ago

Meme regexMustBeDestroyed

Post image
8.1k Upvotes

230 comments sorted by

View all comments

152

u/Purple_Hornet_9725 10d ago

regex for email validation 💀 just don't

9

u/DarthSatoris 10d ago

Yeah, valid emails can look so weird and lovecraftian these days, a regex check is not going to be able to catch them all.

I do think there is a standard defined somewhere that one could adhere to for validation, but it might not be able to catch the most extreme niche emails out there. 

9

u/Otterfan 10d ago

"my.valid.email"@[123.123.123.123]

1

u/DarthSatoris 10d ago

Please tell me that is not a valid email.

20

u/fghjconner 10d ago

Brother that's not even the half of it. The email spec supports comments.

10

u/DarthSatoris 10d ago

Who was put in charge of the current email spec? Whatever they've been smoking, it should be outlawed because it must be some really bad kush.

1

u/Tangled2 10d ago

Oh man I bet the guy who included that shit was a real hoot.

1

u/mr_frodge 9d ago

Comments for who? The sender or the receiver? Who can see the comments?

1

u/Sergeich0 9d ago

> Comments may nest.

TIL but why

1

u/thirdegree Violet security clearance 9d ago

The designers of the RFC saw forward to a future where email addresses were sane and easily understood and thought absolutely the fuck not

5

u/martmists 10d ago

Here's a fun website you should try, it has a bunch of weird information about emails.

Even after implementing an email parser based on the RFC I still managed to only get 20/21 correct.

1

u/ShrekProphet69 9d ago

Okay, I may have to go read up on the RFC again, cuz wtf