diff --git a/lib/vocabularies/code.ts b/lib/vocabularies/code.ts index 63ad9022d..498d9159f 100644 --- a/lib/vocabularies/code.ts +++ b/lib/vocabularies/code.ts @@ -98,11 +98,10 @@ export function usePattern({gen, it: {opts, errSchemaPath}}: KeywordCxt, pattern let rx: RegExpLike try { - rx = new RegExp(pattern, u) + rx = regExp(pattern, u) } catch (e) { throw new Error(`${(e as Error).message} | pattern ${pattern} at ${errSchemaPath}`) } - rx = regExp(pattern, u) return gen.scopeValue("pattern", { key: rx.toString(),