diff --git a/NEWS.md b/NEWS.md index f5877ae2..76dba7c4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -89,7 +89,7 @@ This will help extract forms from longitudinal & repeating projects. * `validate_repeat_instance()` * `validate_no_logical()` * `redcap_read()` checks the `event` parameter and throws an error if a value is not recognized, or the project is not longitudinal (#493) -* The regex in `regex_named_captures()` is forgiving if there's an unnecessary leading space (@BlairCooper, #495) +* The regex in `regex_named_captures()` is forgiving if there's an unnecessary leading space (@BlairCooper, #495, #501) Version 1.1.0 (released 2022-08-10) ========================================================== diff --git a/R/metadata-utilities.R b/R/metadata-utilities.R index 0d4a2f4b..9ebff6c9 100644 --- a/R/metadata-utilities.R +++ b/R/metadata-utilities.R @@ -82,6 +82,7 @@ #' choices_3 <- ds_metadata_3[ds_metadata_3$field_name=="race", "select_choices_or_calculations"] #' REDCapR::regex_named_captures(pattern = pattern_boxes, text = choices_3) +#' @importFrom magrittr %>% #' @export regex_named_captures <- function(pattern, text, perl = TRUE) { checkmate::assert_character(pattern, any.missing = FALSE, len = 1, min.chars = 0L) @@ -110,11 +111,25 @@ regex_named_captures <- function(pattern, text, perl = TRUE) { } #' @rdname metadata_utilities +#' @importFrom rlang .data #' @export checkbox_choices <- function(select_choices) { checkmate::assert_character(select_choices, any.missing=FALSE, len=1, min.chars=1) - pattern_checkboxes <- "(?<=\\A| \\| |\\| )(?\\d{1,}), (?