3 ms·
The one I use for anything that might take user input from a browser is the one defined in the HTML5 spec for input[type=email]: /^[a-zA-Z0-9.!#$%&'*+\/=?^
by eyelidlessness 6y ago
The one I use for anything that might take user input from a browser is the one defined in the HTML5 spec for input[type=email]:
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
There’s no sense being less permissive, if it’s good enough for browsers it’s the baseline expected by browser users. But there’s no sense being more permissive for the same reason.
- deleted 6y ago[deleted]
- anoncake 6y agoYes, there is. HTML does not define what email addresses look like. If input [type=email] rejects valid addresses, it's harmful garbage.
- eyelidlessness 6y agoHuh? My point is that if you expect user input from a browser’s input[type=email], you have little choice but to accept that it will reject emails not matching that pattern. Harmful garbage or not, a more permissive pattern won’t mitigate that.