3 ms·
Am I not getting something or why is this interesting? Some random 7 year old PHP library, cool?
by agolio 4y ago
Am I not getting something or why is this interesting? Some random 7 year old PHP library, cool?
- ashleyn 4y agoI believe the subtext is that "proper" validation of an email is deceptively complex when you would expect a single regex to do. I can't really vouch for if that assumption holds or not.
- taylorbuley 4y agoIf there are any lessons to be had here, this one is certainly amongst them.
- corentin88 4y agoOP here. That was my point indeed.
- drpixie 4y agoYes. And not much point in all that careful checking against the RFCs - many email servers use, accept, and correctly process email addressed to technically invalid addresses. This library runs the risk of blocking actual, working email addresses.
- hn_throwaway_99 4y agoThe code itself is very helpful and interesting, https://github.com/dominicsayers/isemail/blob/master/is_email.php https://github.com/dominicsayers/isemail/blob/master/is_emai.... Point is that checking whether something is a valid email or not is 1179 lines long (I know there are a lot of comments). Particularly interesting is to look at all of the possible error conditions, and the fact that "whether a string is an email address" is not so much a binary yes-no, but the library provides a "likeliness threshold" option. Essentially just pointing out that checking if a string is/can be an email address is surprisingly complex.