colinhacks / zod

TypeScript-first schema validation with static type inference
https://zod.dev
MIT License
33.92k stars 1.18k forks source link

[Feature Request] take regular expressions to support progressive improvement #3661

Open MrOxMasTer opened 3 months ago

MrOxMasTer commented 3 months ago

Well, it would be nice to add a function that could pull a regular expression from the validation scheme, at least for strings, so that if js is disabled, the pattern in input can work:

image

To somehow unify verification on the client (even if there is no js) and validation on the server

const regExp = z.string().email()
...

return (
<input 
   pattern={regExp}
/>
)