variable_args_list: variable args list

variable_args_listR Documentation

variable args list

Description

Parse the variable-length argument list used in str_match_variable, str_match_all_variable, and df_match_variable. This function is mostly intended for internal use, but is useful if you want to see the regex pattern generated by the variable argument syntax.

Usage

variable_args_list(...)

Arguments

...

character vectors (for regex patterns) or functions (which specify how to convert extracted character vectors to other types). All patterns must be character vectors of length 1. If the pattern is a named argument in R, we will add a name tag in the regex pattern. All patterns are pasted together to obtain the final pattern used for matching. Each named pattern may be followed by at most one function which is used to convert the previous named pattern. Patterns may also be lists, which are parsed recursively for convenience.

Value

a list with two named elements

fun.list

list of conversion functions or NULL

pattern

regular expression string

Author(s)

Toby Dylan Hocking

Examples


pos.pattern <- list("[0-9]+", as.integer)
namedCapture::variable_args_list(
  "some subject",
  chrom="chr.*?",
  ":",
  chromStart=pos.pattern,
  list(
    "-",
    chromEnd=pos.pattern
  ), "?")


tdhock/namedCapture documentation built on Jan. 27, 2024, 9:02 p.m.