Function regexGetGroupNames

  • Returns an array of group names from a regular expression.

    Parameters

    • re: RegExp

      The regular expression to extract group names from.

    Returns string[]

    An array of group names.

    Example

    regexGetGroupNames(/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/);;
    //=> ['year', 'month', 'day']

    Remarks

    This function only works with regular expressions that use named capture groups.

Generated using TypeDoc