fixed_to_regexp: Convert fixed expression to regular expression

Description Usage Arguments Value Examples

View source: R/fixed_to_regexp.R

Description

A back slash (\ ) is added before special symbols (. \ | ( ) [ { }^ $ * + ?) in a string str to interpret them as "fixed" in a regular expression. Useful in functions, which accept regular expressions but do not have option fixed = TRUE.

Usage

1

Arguments

str

A string

Value

The string rewritten as regular expression.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fixed_to_regexp("\\")
  ## "\\"

fixed_to_regexp("||")
fixed_to_regexp(".\\|(){}^$*+?[]")

fixed_to_regexp("(A|B)")
 ## "\(A\|B\)"

fixed_to_regexp("Hello!") # nothing is changed
  ## "Hello!"

GegznaV/spMisc documentation built on April 26, 2020, 5:59 p.m.