538
538
</t >
539
539
</section >
540
540
541
+ <section title =" Regular Expressions" anchor =" regex" >
542
+ <t >
543
+ Keywords MAY use regular expressions to express constraints, or constrain
544
+ the instance value to be a regular expression.
545
+ These regular expressions SHOULD be valid according to the
546
+ <xref target =" ecma262" >ECMA 262</xref > regular expression dialect.
547
+ </t >
548
+ <t >
549
+ Furthermore, given the high disparity in regular expression constructs support,
550
+ schema authors SHOULD limit themselves to the following regular expression
551
+ tokens:
552
+
553
+ <list >
554
+ <t >individual Unicode characters, as defined by the <xref
555
+ target =" RFC8259" >JSON specification</xref >;</t >
556
+ <t >simple character classes ([abc]), range character classes ([a-z]);</t >
557
+ <t >complemented character classes ([^abc], [^a-z]);</t >
558
+ <t >simple quantifiers: "+" (one or more), "*" (zero or more), "?" (zero or
559
+ one), and their lazy versions ("+?", "*?", "??");</t >
560
+ <t >range quantifiers: "{x}" (exactly x occurrences), "{x,y}" (at least x, at
561
+ most y, occurrences), {x,} (x occurrences or more), and their lazy
562
+ versions;</t >
563
+ <t >the beginning-of-input ("^") and end-of-input ("$") anchors;</t >
564
+ <t >simple grouping ("(...)") and alternation ("|").</t >
565
+ </list >
566
+ </t >
567
+ <t >
568
+ Finally, implementations MUST NOT take regular expressions to be
569
+ anchored, neither at the beginning nor at the end. This means, for instance,
570
+ the pattern "es" matches "expression".
571
+ </t >
572
+ </section >
573
+
541
574
<section title =" Extending JSON Schema" >
542
575
<t >
543
576
Additional schema keywords and schema vocabularies MAY be defined
@@ -1505,8 +1538,9 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
1505
1538
</t >
1506
1539
<t >
1507
1540
Interoperability considerations: See Sections
1508
- <xref target =" language" format =" counter" ></xref > and
1509
- <xref target =" integers" format =" counter" ></xref > above.
1541
+ <xref target =" language" format =" counter" ></xref >,
1542
+ <xref target =" integers" format =" counter" ></xref >, and
1543
+ <xref target =" regex" format =" counter" ></xref >above.
1510
1544
</t >
1511
1545
<t >
1512
1546
Fragment identifier considerations: See Section
@@ -1548,8 +1582,9 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
1548
1582
</t >
1549
1583
<t >
1550
1584
Interoperability considerations: See Sections
1551
- <xref target =" language" format =" counter" ></xref > and
1552
- <xref target =" integers" format =" counter" ></xref > above.
1585
+ <xref target =" language" format =" counter" ></xref >,
1586
+ <xref target =" integers" format =" counter" ></xref >, and
1587
+ <xref target =" regex" format =" counter" ></xref >above.
1553
1588
</t >
1554
1589
<t >
1555
1590
Fragment identifier considerations: See Section
@@ -1570,6 +1605,14 @@ User-Agent: product-name/5.4.1 so-cool-json-schema/1.0.2 curl/7.43.0
1570
1605
&RFC6901;
1571
1606
&RFC8259;
1572
1607
&ldp;
1608
+ <reference anchor =" ecma262"
1609
+ target =" http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf" >
1610
+ <front >
1611
+ <title >ECMA 262 specification</title >
1612
+ <author />
1613
+ <date />
1614
+ </front >
1615
+ </reference >
1573
1616
</references >
1574
1617
1575
1618
<references title =" Informative References" >
0 commit comments