Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to the string email regex #2003

Closed
andresBobsled opened this issue Feb 7, 2023 · 1 comment · Fixed by #2007
Closed

Access to the string email regex #2003

andresBobsled opened this issue Feb 7, 2023 · 1 comment · Fixed by #2007
Labels
enhancement New feature or request

Comments

@andresBobsled
Copy link
Contributor

Could the string email regex pattern be exported?
Or accessed somehow by passing zod.string().email() as param?

Motivation:

html input of type="email" is more permissive than zod email, alloing for example a@b, which zod does not allow.

Html input has the pattern attribute.

We would like thus to be able to then pass the zod email regex pattern to the html pattern attribute, so then the browser can be in charge of not submitting the form if invalid, showing the appropriate error, etc. Otherwise, we have to call onSubmit, with zod.SafeParse and if not success manually set/show the error on the input.

Thank you.

@JacobWeisenburger
Copy link
Collaborator

Could the string email regex pattern be exported?

PRs are always welcome.

@JacobWeisenburger JacobWeisenburger added the enhancement New feature or request label Feb 7, 2023
@JacobWeisenburger JacobWeisenburger linked a pull request Feb 7, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants