origami:

regexMatch(text, regex)

Matches the given text against a regular expression containing named capturing groups. If the expression matches, this returns the capturing groups; otherwise this returns undefined.

Example: the following Origami program uses regexMatch to identify parts of a date at the beginning of a string, perhaps a blog post file name.

// parseDate.ori
// Parse a YYYY-MM-DD date from the start of the text.

(text) =>
  regexMatch(text, "^(?<date>\\d\\d\\d\\d-\\d\\d-\\d\\d)")

  // Dates will end up in GMT, so we shift the date to the desired time zone.
  // This sample content uses noon in U.S. Eastern Time, which is UTC minus 5
  // hours. See https://en.wikipedia.org/wiki/List_of_UTC_offsets for a list of
  // UTC offsets; replace with the time zone you want for your posts.
  → (match) => new:Date(`${ match/date }T12:00-05:00`)

When applied to a file name that contains a date:

$ ori parseDate.ori "'2026-01-01 Happy New Year.md'"
Thu Jan 01 2026 17:00:00 GMT+0000 (Coordinated Universal Time)

(This creates a date in U.S. Eastern time, although the date is displayed above in the time zone of the machine used to build this site. The date and time are still correct for Eastern time.)