2

I am surprised that an answer to this is not easily found.

I am in the process of making a JSON schema. I have an object and one of it's properties is a string containing a regex pattern. This property must contain only regex.

So, this question is realistically two questions in one:

What is the regex pattern that describes regex patterns (javascript-compatible please)?

Secondly, how do I apply this to JSON schema (in the "pattern" property or even in the "patternProperty"1 property)?

1: I have no idea what purpose would require you to apply this in "patternProperty", but someone out there could find it useful

NOTE: Since, JSONschema is JSON and JSON is JavaScript-based, JavaScript scripters may find the solution (to the JSONschema-side of the question), as well as the problem, useful in their scripts.

1 Answers1

1

Regexes can have nested parentheses.

Therefore, they are not describable by a regular expression.
Sorry.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964