2 ms·
Good points. Why do regex tests at all if emails could fail in any number of ways? If you're going to test for at least 3 characters with a @ in the middle, yo
by theandrewbailey 9y ago
Good points. Why do regex tests at all if emails could fail in any number of ways?
If you're going to test for at least 3 characters with a @ in the middle, you probably should implement some other simple rules to have a snowball's chance on the internet:
only one @
no spaces
has TLD (guarantee at least one period after @, and something else after, no consecutive periods)
can't begin or end with a period
- dredmorbius 9y agoA (very simple) regex text might exclude some randomly-entered garbage or inadvertantly invalid address. Even then, the scope and reliability of such tests is minuscule.
- Xylakant 9y agoYour “has TLD” test is already wrong: localpart@tld (example@de) is an odd, but valid address.