Closed abdulkerimawad closed 4 months ago
Hi there, there is something wrong with your regex and it is quite complicated so debugging it is difficult. It also doesn't help that you are using a non standard way to construct the regex. Please follow the instructions here - https://ajv.js.org/json-schema.html#pattern.
Basically AJV will take the string passed to pattern
and pass it into new RegExp(your_pattern_string, "u")
. So try constructing your regex using new RegExp with the "u" second param. If you can get that to succeed, then your schema will work with the same string. If you have trouble figuring out what's wrong, try starting with a simpler regex and build up to what you need, bit by bit.
What version of Ajv are you using? Does the issue happen if you use the latest version? Ajv version: 8.16.0
Ajv options object
JSON Schema
Sample data
Your code
Validation result, data AFTER validation, error messages
What results did you expect? I expected the regex to be valid and the data to match it like in the RegExr website
Are you going to resolve the issue? I don't know yet, I hope the ajv team resolves it