Learn R Programming

rebus.base (version 0.0-3)

escape_special: Escape special characters

Description

Prefix the special characters with a blackslash to make them literal characters.

Usage

escape_special(x, escape_brace = TRUE)

Arguments

x
A character vector.
escape_brace
A logical value indicating if opening braces should be escaped. If using R's internal PRCE engine or stringi's ICU engine, you want this. If using the perl engine, you don't.

Value

A character vector, with regex meta-characters escaped.

Examples

Run this code
escape_special("\\ ^ $ . | ? * + ( ) { } [ ]")

Run the code above in your browser using DataLab