Zod · Method
.regex
Use z.string().regex() to validate a string against a regular expression. Parsing fails when the value does not match the pattern.
Last updated
Syntax
z.string().regex(pattern)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
z.string()z.string().min()z.string().max()z.stringFormat()