2 ms·
The code itself is very helpful and interesting, https://github.com/dominicsayers/isemail/blob/master/is_email.php https://github.com/dominicsayers/isemail/blob
by hn_throwaway_99 4y ago
The 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.