% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/character.r
\name{grep-wrappers}
\alias{grep-wrappers}
\alias{grepf}
\alias{grepi}
\title{Pattern Matching}
\usage{
grepf(pattern, x, value = FALSE, useBytes = FALSE, invert = FALSE)

grepi(
  pattern,
  x,
  perl = FALSE,
  value = FALSE,
  useBytes = FALSE,
  invert = FALSE
)
}
\arguments{
\item{pattern}{character string containing a regular expression (or character string
for \code{fixed = TRUE} to be matched in the given character vector.
Coerced by \link{as.character} to a character string if possible.
If a character vector of length \code{2} or more is supplied, the first
element is used with a warning. Missing values are allowed.}

\item{x}{a character vector where matches are sought, or an object
which can be coerced by \link{as.character} to a character vector.
Long vectors are supported.}

\item{value}{logical. If \code{FALSE}, a vector containing the (integer) indices of
the matches determined by grep is returned, and if \code{TRUE}, a vector
containing the matching elements themselves is returned.}

\item{useBytes}{logical. If \code{TRUE} the matching is done byte-by-byte rather
than character-by-character.}

\item{invert}{logical. If \code{TRUE} return indices or values for elements that
do not match.}

\item{perl}{logical. Should Perl-compatible regexps be used?}
}
\value{
with \code{value = FALSE}, return a vector of the
indices of the elements of \code{x} that yielded a match (or not,
for \code{invert = TRUE}). This will be an integer vector unless
the input is a long vector, when it will be a double vector.

with \code{value = TRUE}, return a character vector containing the
selected elements of \code{x} (after coercion, preserving names but
no other attributes).
}
\description{
Strongly typed wrappers around \code{\link{grep}} that have the
\code{fixed} and \code{ignore.case} arguments set internally.
}
\details{
\verb{*f()} suffixed functions have \code{fixed = TRUE} and conflicting
arguments (\code{perl} and \code{ignore.case}) set as \code{FALSE}.

\verb{*i()} suffixed functions have \code{ignore.case = TRUE} and the
conflicting \code{fixed} argument set as \code{FALSE}.

For full documentation of the wrapped functions, see the help
pages for \code{\link{grep}}.
}
\examples{
grepf("foo", c("foo", "Foo", "bar"))
grepf("foo", c("foo", "Foo", "bar"), value = TRUE)
grepi("foo", c("foo", "Foo", "bar"))
grepi("foo", c("foo", "Foo", "bar"), value = TRUE)
}
\seealso{
Other pattern-match-replacement-wrappers:
\code{\link{grepl-wrappers}},
\code{\link{grepv-wrappers}},
\code{\link{sub-wrappers}}
}
\concept{pattern-match-replacement-wrappers}
