Repetition and Lists
Repeating Matchers
Section titled “Repeating Matchers”Use {min,max} syntax after a matcher to specify repetition constraints:
Unbounded Repetition
Section titled “Unbounded Repetition”Use {,} to allow unlimited repetitions:
schema.mds
`item:/\w+/`{,}input.md
oneOutput:
{"item":"one"}schema.mds
`item:/\w+/`{,}input.md
one two three four fiveOutput:
{"item":"one two three four five"}Exact Count
Section titled “Exact Count”schema.mds
`digit:/\d/`{3,3}input.md
123Output:
{"digit":"123"}schema.mds
`digit:/\d/`{3,3}input.md
12Range Constraints
Section titled “Range Constraints”schema.mds
`num:/\d+/`{2,4}input.md
12 34Output:
{"num":"12 34"}schema.mds
`num:/\d+/`{2,4}input.md
12Lists validate structured list content with support for literal items, matchers, and repetition.
Basic List Matching
Section titled “Basic List Matching”schema.mds
- Item 1- Item 2input.md
- Item 1- Item 2schema.mds
- Item 1- Item 2input.md
- Item 1- Item 3List Items with Matchers
Section titled “List Items with Matchers”schema.mds
- `name:/\w+/`- `age:/\d+/`input.md
- Alice- 25Output:
{"name":"Alice","age":"25"}Repeated List Items
Section titled “Repeated List Items”Use {min,max} on list item matchers to match multiple items:
schema.mds
- `item:/\w+/`{2,4}input.md
- apple- bananaOutput:
{"item":["apple","banana"]}schema.mds
- `item:/\w+/`{2,4}input.md
- appleschema.mds
- `task:/\w+/`{,}input.md
- work- study- exerciseOutput:
{"task":["work","study","exercise"]}Nested Lists
Section titled “Nested Lists”schema.mds
- Parent - `child:/\w+/`{1,2}input.md
- Parent - child1 - child2Output:
{"child":["child1","child2"]}schema.mds
- Parent - Childinput.md
- Parent- ChildMultiple Matchers in Sequence
Section titled “Multiple Matchers in Sequence”schema.mds
- `first:/test\d/`{2,2}- `second:/foo\d/`{1,2}input.md
- test1- test2- foo1Output:
{"first":["test1","test2"],"second":["foo1"]}- List matchers return arrays when repeated
- Variable-length matchers must be at the end of a list schema
- Indentation levels must match for nested lists