stringr (version 0.3)

fixed: Escape all special regular expression characters.

Description

Escape all special regular expression characters.

Usage

fixed(string)

Arguments

string
string to match exactly as is

Details

This function escapes all characters that have meaning for regular expressions so the string will be matched exactly as is.

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