% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pattern_check.R
\name{pattern_check}
\alias{pattern_check}
\title{Check Character Patterns}
\usage{
pattern_check(data, variable, pattern, ignore_case = FALSE)
}
\arguments{
\item{data}{A data.frame.}

\item{variable}{A single character string specifying the
variable to check.}

\item{pattern}{A single non-empty character string
containing a regular expression.}

\item{ignore_case}{Logical. If TRUE, matching ignores
letter case. Default is FALSE.}
}
\value{
A data.frame of class \code{PatternCheck}
containing row-level pattern diagnostics.
}
\description{
Checks whether values in a character or factor variable
match a user-specified regular expression.
}
\details{
Missing values are reported separately and are not
classified as matching or invalid.

Factor variables are converted to character internally
for pattern matching. The original values are retained
in the returned data frame.

Pattern matching is performed using \code{grepl()}.
}
\examples{
dat <- data.frame(
  Sample_ID = c(
    "SMP-001",
    "SMP-002",
    "BAD-003",
    NA
  ),
  stringsAsFactors = FALSE
)

pattern_check(
  dat,
  variable = "Sample_ID",
  pattern = "^SMP-[0-9]{3}$"
)

}
