Learn R Programming

stringr (version 0.6.2)

fixed: Match fixed characters, not regular expression.

Description

This function specifies that a pattern is a fixed string, rather than a regular expression. This can yield substantial speed ups, if regular expression matching is not needed.

Usage

fixed(string)

Arguments

string
string to match exactly as is

See Also

Other modifiers: ignore.case, perl

Examples

Run this code
pattern <- "a.b"
strings <- c("abb", "a.b")
str_detect(strings, pattern)
str_detect(strings, fixed(pattern))

Run the code above in your browser using DataLab