The Front Matter
Capture everything between the opening and closing --- markers of a Markdown front-matter block.
The dot matches any character except a line terminator. That single exception is why "just use .*" stops working the moment your input has more than one line. The s flag — dotAll — removes the exception. The long-hand alternative is a character class that covers everything, [\s\S], which costs four characters more than the flag does. Two things then bite. The block is the one at the START of the file, so anchor it — otherwise a --- further down can open a block of its own. And it ends at the FIRST closing marker: a Markdown horizontal rule in the body is three dashes too, and a greedy .* will happily swallow the whole document to reach it.
---␊title: Hi␊tags: a␊---␊Body text→ ["\ntitle: Hi\ntags: a\n"]---␊draft: true␊---␊␊# Heading→ ["\ndraft: true\n"]---␊x␊---→ ["\nx\n"]no front matter heremust not match---␊title: Hi␊---␊␊Body␊␊---␊␊Footer→ ["\ntitle: Hi\n"]a horizontal rule in the body is not the closing marker
+ 5 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.