Function captureRegex

  • Like regexParser, but you can name your capture groups and get them back as the result instead. Fails if it doesn't have the same number of names as capture groups.

    Type Parameters

    • const T extends string[]

    Parameters

    • str: string | RegExp

      regex string or RegExp instance to match

    • options: string = ""

      string of regex options (i = ignore case, g = global, m = multiline, u = unicode)

    • Rest ...captureNames: T

      names of the captures

    Returns Parser<Prettify<Record<typeof captureNames[number], string>>>

    • parser that matches the given regex

Generated using TypeDoc