Comment on I'm locked out of my 6 year old Chipotle account because they now say my email address is invalid when I login. Here is me asking for their help:
Here’s my address: @@@@@
And this right here is a great example of why simple basic RegEx is rarely adequate
At the very least, should be something like
^[^@\s]+@([^@\s.]+\.)+[^@\s.]+$
I’m like 99% sure I missed at least a few cases there, and will say “please don’t use this for anything production”
Here’s two: you can have multiple @s forming relays in an email address, and you can also break all the rules around dots and spaces if you put quotes around the local part, eg “.sarah…”@emails.com
And this is exactly why I wouldn’t do my own, I had no idea either of those were legal/possible
To be fair nor do most email providers! It’s in the spec, though.
laurelraven@lemmy.blahaj.zone 10 months ago
And this right here is a great example of why simple basic RegEx is rarely adequate
At the very least, should be something like
^[^@\s]+@([^@\s.]+\.)+[^@\s.]+$
I’m like 99% sure I missed at least a few cases there, and will say “please don’t use this for anything production”
jpeps@lemmy.world 10 months ago
Here’s two: you can have multiple @s forming relays in an email address, and you can also break all the rules around dots and spaces if you put quotes around the local part, eg “.sarah…”@emails.com
laurelraven@lemmy.blahaj.zone 10 months ago
And this is exactly why I wouldn’t do my own, I had no idea either of those were legal/possible
jpeps@lemmy.world 10 months ago
To be fair nor do most email providers! It’s in the spec, though.