I am surprised that the answer to this question is not easy to find.
I am making a JSON schema. I have an object, and one of its properties is a string containing a regular expression pattern. This property should only contain a regular expression.
So this question is realistically two questions in one:
What is a regex pattern that describes regex patterns (compatible with javascript)?
Secondly, how to apply this to a JSON schema (in the "pattern" property or even in the "patternProperty" 1 property)?
1 : I have no idea for what purpose you will need to apply this in "patternProperty" , but someone out there might find this useful
NOTE. . Since JSONschema is JSON and JSON is JavaScript, JavaScript scripts can find a solution (on the JSON side of the question), as well as a problem useful in their scripts.
user3186555
source share