R/capture_groups.R

Defines functions rx_begin_capture rx_end_capture

Documented in rx_begin_capture rx_end_capture

#' Begin a capture group.
#'
#' @details Capture groups are used to extract data from within the regular
#' expression match for further processing.
#'
#' @param .data Expression to append, typically pulled from the pipe \code{ \%>\% }
#'
#' @export
rx_begin_capture <- function(.data = NULL) {
  new_rx(paste0(.data, "("))
}

#' End a capture group.
#'
#' @details Capture groups are used to extract data from within the regular
#' expression match for further processing.
#'
#' @param .data Expression to append, typically pulled from the pipe \code{\%>\%}
#'
#' @export
rx_end_capture <- function(.data = NULL) {
  new_rx(paste0(.data, ")"))
}

Try the RVerbalExpressions package in your browser

Any scripts or data that you put into this service are public.

RVerbalExpressions documentation built on Nov. 6, 2019, 5:08 p.m.