Skip to content

regexGroups

regexGroups(string, pattern) → array · String

Extract all capture groups from the first match of a regex pattern.

  • string (required): the string to search

  • pattern (required): regex with capture groups

utlx
regexGroups("2026-05-01", "(\\d{4})-(\\d{2})-(\\d{2})")
// ["2026", "05", "01"]

Released under AGPL-3.0.