4 ms·
Oh dang, I didn't even think about @ symbols within quotes. I guess the smoke test regex needs to be even MORE permissive: [^\s]+@[^\s]+ I guess you could g
by t0mbstone 7y ago
Oh dang, I didn't even think about @ symbols within quotes. I guess the smoke test regex needs to be even MORE permissive:
[^\s]+@[^\s]+
I guess you could get even more crazy and go ahead just do the most bare-bones check possible really:
.+@.+
And you were right. The first regex got screwed up when I copied and pasted it. Here's a better source from https://emailregex.com https://emailregex.com
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
I suppose there isn't a whole lot of value even using a quick "smoke test" regex, when the big version is already a solved problem, and can be so easily copied and pasted at this point...