Skip to contents

These functions retrieve or set the perl property of an object of class re.

Usage

perl_flavor(x)

perl_flavor(x) <- value

Arguments

x

Object of class re.

value

Logical.

Value

A logical vector of length 1.

Details

The assignment function merely sets the perl property so that the x attribute is read as an expression using the PCRE flavor of regular expression (when perl = TRUE) or not (when perl = FALSE). The regular expression itself is not modified: if perl is set to an inappropriate value, the regular expression will no longer function properly in any of the functions that support re objects.

Examples

(regex <- re("^.{3,}"))
#> Regular expression (perl = TRUE)
#> ------------------
#> ^.{3,} 
perl_flavor(regex)
#> [1] TRUE

perl_flavor(regex) <- FALSE
perl_flavor(regex)
#> [1] FALSE
regex
#> Regular expression (perl = FALSE)
#> ------------------
#> ^.{3,} 

perl_flavor(regex) <- TRUE
perl_flavor(regex)
#> [1] TRUE
regex
#> Regular expression (perl = TRUE)
#> ------------------
#> ^.{3,}