| ) | ) | ||||
| ) | ) | ||||
| available_regex_functions <- function() { | |||||
| pkgs <- c("stringr", "rematch2") | |||||
| has_pkg <- vapply(pkgs, requireNamespace, quietly = TRUE, logical(1)) | |||||
| regexFn_choices[c("base", pkgs[has_pkg])] | |||||
| } | |||||
| regexFn_substitute <- c( | regexFn_substitute <- c( | ||||
| paste0(c("", "g"), "sub"), | paste0(c("", "g"), "sub"), | ||||
| paste0("str_replace", c("", "_all")) | paste0("str_replace", c("", "_all")) |
| selectInput( | selectInput( | ||||
| "regexFn", | "regexFn", | ||||
| label = "Apply Function", | label = "Apply Function", | ||||
| choices = regexFn_choices | |||||
| choices = available_regex_functions() | |||||
| ), | ), | ||||
| tags$span( | tags$span( | ||||
| class = "help-block", | class = "help-block", |