Skip to content

Commit 35f4e49

Browse files
Make the regex limitations directly follow the pattern keyword.
1 parent 8bec5e4 commit 35f4e49

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

extending-the-rest-api/schema.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,20 @@ array(
397397
);
398398
```
399399

400+
The regex is not automatically anchored. Regex flags, for instance `/i` to make the match case insensitive are not supported.
401+
402+
The JSON Schema RFC recommends limiting yourself to the following regex features so the schema can be interoperable between as many different programming languages as possible.
403+
404+
- individual Unicode characters, as defined by the JSON specification [RFC4627].
405+
- simple character classes `[abc]`, range character classes `[a-z]`.
406+
- complemented character classes `[^abc]`, `[^a-z]`.
407+
- simple quantifiers: `+` (one or more), `*` (zero or more), `?` (zero or one), and their lazy versions `+?`, `*?`, `??`.
408+
- range quantifiers: `{x}` (exactly x occurrences), `{x,y}` (at least x, at most y, occurrences), `{x,}` (x occurrences or more), and their lazy versions.
409+
- the beginning-of-input `^` and end-of-input `$` anchors.
410+
- simple grouping `(...)` and alternation `|`.
411+
412+
The pattern should be valid according to the ECMA 262 regex dialect.
413+
400414
### Numbers
401415

402416
The `number` and `integer` types support four additional keywords.
@@ -784,20 +798,6 @@ While this would fail validation.
784798
}
785799
```
786800

787-
The regex is not automatically anchored. Regex flags, for instance `/i` to make the match case insensitive are not supported.
788-
789-
The JSON Schema RFC recommends limiting yourself to the following regex features so the schema can be interoperable between as many different programming languages as possible.
790-
791-
- individual Unicode characters, as defined by the JSON specification [RFC4627].
792-
- simple character classes `[abc]`, range character classes `[a-z]`.
793-
- complemented character classes `[^abc]`, `[^a-z]`.
794-
- simple quantifiers: `+` (one or more), `*` (zero or more), `?` (zero or one), and their lazy versions `+?`, `*?`, `??`.
795-
- range quantifiers: `{x}` (exactly x occurrences), `{x,y}` (at least x, at most y, occurrences), `{x,}` (x occurrences or more), and their lazy versions.
796-
- the beginning-of-input `^` and end-of-input `$` anchors.
797-
- simple grouping `(...)` and alternation `|`.
798-
799-
The pattern should be valid according to the ECMA 262 regex dialect.
800-
801801
## Changelog
802802

803803
### WordPress 5.5

0 commit comments

Comments
 (0)