Bugfix: Commas are incorrectly allowed in email regex.
In #2824, email regex changed, but it seems inadvertently allowed , which were previously not permitted in email.
Email regex before #2824
/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
Email regex after #2824
/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
For the latter part [A-Z0-9_+-\.], it probably wanted to add only . to [A-Z0-9_+-].
But, the addition of . after the unescaped hyphen has caused it to be interpreted as a range from + to ..
Therefore, , contained between + and . is now permitted.
So, fix this issue with escaping hyphens simply.
Deploy Preview for guileless-rolypoly-866f8a ready!
| Name | Link |
|---|---|
| Latest commit | 40e72f9eaf576985f876d1afc2dbc22f73abc1ba |
| Latest deploy log | https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/661f05dd2509bd0008bbcaef |
| Deploy Preview | https://deploy-preview-3286--guileless-rolypoly-866f8a.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Thank you! Fantastic PR, apologies for the delay on such a no-brainer PR. That accidental range issue could have been a lot worse lol.
This has landed in Zod 3.23.
https://github.com/colinhacks/zod/releases/tag/v3.23.0