diff --git a/deno/lib/__tests__/string.test.ts b/deno/lib/__tests__/string.test.ts index 3f5b95562..3fc6ec0f4 100644 --- a/deno/lib/__tests__/string.test.ts +++ b/deno/lib/__tests__/string.test.ts @@ -331,6 +331,8 @@ test("ulid", () => { if (!result.success) { expect(result.error.issues[0].message).toEqual("Invalid ulid"); } + const caseInsensitive = ulid.safeParse("01arZ3nDeKTsV4RRffQ69G5FAV") + expect(caseInsensitive.success).toEqual(true) }); test("regex", () => { diff --git a/deno/lib/types.ts b/deno/lib/types.ts index 9a6311289..d634e524f 100644 --- a/deno/lib/types.ts +++ b/deno/lib/types.ts @@ -575,7 +575,7 @@ export interface ZodStringDef extends ZodTypeDef { const cuidRegex = /^c[^\s-]{8,}$/i; const cuid2Regex = /^[0-9a-z]+$/; -const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; +const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i; // const uuidRegex = // /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i; const uuidRegex = diff --git a/src/__tests__/string.test.ts b/src/__tests__/string.test.ts index db01a64eb..b79664fff 100644 --- a/src/__tests__/string.test.ts +++ b/src/__tests__/string.test.ts @@ -330,6 +330,8 @@ test("ulid", () => { if (!result.success) { expect(result.error.issues[0].message).toEqual("Invalid ulid"); } + const caseInsensitive = ulid.safeParse("01arZ3nDeKTsV4RRffQ69G5FAV") + expect(caseInsensitive.success).toEqual(true) }); test("regex", () => { diff --git a/src/types.ts b/src/types.ts index f89acb5e0..0767073c5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -575,7 +575,7 @@ export interface ZodStringDef extends ZodTypeDef { const cuidRegex = /^c[^\s-]{8,}$/i; const cuid2Regex = /^[0-9a-z]+$/; -const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; +const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i; // const uuidRegex = // /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i; const uuidRegex =