-
-
Notifications
You must be signed in to change notification settings - Fork 328
Closed
Labels
proposalInitial discussion of a new idea. A project will be created once a proposal document is created.Initial discussion of a new idea. A project will be created once a proposal document is created.
Description
Describe the inspiration for your proposal
Authoring JSON Schemas that utilize regex patterns for properties where we do not want a string to end in a certain character (such as -
or _
); for this, negative lookbehinds are a highly useful tool.
Describe the proposal
As of today, while JSON Schema supports lookahead regex patterns, it does not appear to support lookbehinds. See:
- https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/83e866b46c9f9e7082fd51e83a61c5f2145a1ab7/tests/draft3/optional/format/ecmascript-regex.json#L12
- https://github.com/json-schema-org/website/blob/219521edd56d2c97b68f24c2bf996ba9d5be173d/pages/understanding-json-schema/reference/regular_expressions.md?plain=1#L49
Lookbehind was introduced in ES2018 and now enjoys broad support:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Lookbehind_assertion#browser_compatibility
- https://node.green/#ES2018-features--RegExp-Lookbehind-Assertions
This seems like a natural addition!
Describe alternatives you've considered
No response
Additional context
Previously raised or mentioned in:
Metadata
Metadata
Assignees
Labels
proposalInitial discussion of a new idea. A project will be created once a proposal document is created.Initial discussion of a new idea. A project will be created once a proposal document is created.