Learn R Programming

yulab.utils (version 0.2.3)

set_PCRE: Switch regular expression style (PCRE vs TRE)

Description

  • set_regexpr_style() selects the style explicitly.

  • auto_set_regexpr_style() chooses based on OS (TRE on Windows; PCRE elsewhere).

  • set_PCRE() and set_TRE() force the style.

Usage

set_PCRE()

set_TRE()

use_perl()

set_regexpr_style(style)

auto_set_regexpr_style()

Value

Logical indicating whether to use perl

Arguments

style

one of 'PCRE' or 'TRE'

Author

Guangchuang Yu

Details

These functions do not change the behavior of gsub()/regexpr() directly. They set a global option that you can read via use_perl() and pass to gsub()/regexpr().

References

https://stackoverflow.com/questions/47240375/regular-expressions-in-base-r-perl-true-vs-the-default-pcre-vs-tre