1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/io.R
\name{grep_sub}
\alias{grep_sub}
\title{Perform replacement with \code{gsub()} on elements matched from \code{grep()}}
\usage{
grep_sub(pattern, replacement, x, ...)
}
\arguments{
\item{pattern, replacement, x, ...}{Passed to \code{\link{grep}()} and
\code{gsub()}.}
}
\value{
A character vector.
}
\description{
This function is a shorthand of \code{gsub(pattern, replacement,
grep(pattern, x, value = TRUE))}.
}
\examples{
# find elements that matches 'a[b]+c' and capitalize 'b' with perl regex
xfun::grep_sub("a([b]+)c", "a\\\\U\\\\1c", c("abc", "abbbc", "addc", "123"), perl = TRUE)
}
|