Learn R Programming

re (version 0.1.0)

re_escape: Escape special characters

Description

re_escape escapes all special characters in a string. This function is useful when you want to treat a string literally in a regular expression context, escaping characters that would otherwise be interpreted as special regex operators.

Usage

re_escape(pattern)

Value

A character vector of the same length as pattern.

Arguments

pattern

A character vector where each element is a string in which special regex characters are to be escaped.

See Also

Examples

Run this code
re_escape("a[bc].*d?")
re_escape(".^$|*+?{}[]()")

Run the code above in your browser using DataLab