regexpr-style: switch regular expression style (PCRE vs TRE)

set_PCRER Documentation

switch regular expression style (PCRE vs TRE)

Description

The set_regexpr_style() allows user to specify which style to be used, while the auto_set_regexpr_style() automatically set the style depdending on the operating system (TRE for Windows and PCRE for other OSs (Linux and Mac)).

Usage

set_PCRE()

set_TRE()

use_perl()

set_regexpr_style(style)

auto_set_regexpr_style()

Arguments

style

one of 'PCRE' or 'TRE'

Details

set_PCRE() force to use PCRE style while set_TRE() force to use TRE.

Note that all these functions are not change the behavior of gsub() and regexpr(). The functions are just set a global option to store the user's choice of whether using perl = TRUE.

Users can access the option via use_perl() and pass the return value to gusb() or regexpr() to specify the style in use.

Value

logical value of whether use perl

Author(s)

Guangchuang Yu

References

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


yulab.utils documentation built on Sept. 11, 2024, 9:25 p.m.