/
The .match {content} {pattern} {replacement} docs ↗ function:
.match {Quarkdown takes its name from quarks} pattern:{[Qq]uark(down|s)?}
match:
***.match***Quarkdown takes its name from quarks
The lambda runs once per matched substring, with its argument referring to the matched text.
Using the implicit .1 instead of a named parameter:
.match {Hello, world} pattern:{world}
***.1***Hello, world
.match works naturally in a chain, since content is its first parameter.
.var {greeting} {Hello, world}
.greeting::match {world}
**.1**Hello, world
A common use case is rewriting a function’s output through a regex transformation. For example, you can extend .heading so every occurrence of certain words is highlighted across all headings in the document:
.extend {heading}
content:
.super
.content::match {[Qq]uark(down|s)?}
*.1::uppercase*
###! Quarkdown takes its name from quarks