Please have incompatible search modifiers fixed vs perl / ignore.case be resolved at the call of these function and not defer to the str_* calls. Take the following example:
pattern <-
"str" %>%
ignore.case %>%
perl # %>%
# fixed -> pattern
str(pattern)
# Overriding Perl regexp matching
# atomic [1:1] pattern
# - attr(*, "ignore.case")= logi TRUE
# - attr(*, "perl")= logi TRUE
# - attr(*, "fixed")= logi TRUE
In this case, each of the match modifiers set an attribute to TRUE, though they are incompatible. If one were to examine pattern as is done in the example, the effects are unclear as they will be resolved later. A better method would have successive calls to the modifiers adjust pattern as appropriate. This can be done changing the functions. For example, fixed might become:
fixed <- function(string) {
if (stringr::is.perl(string))
message("Overriding Perl regexp matching")
structure(string, fixed = TRUE, perl = NULL, ignore.case = NULL )
}
Or perl = FALSE as another alternative.
Please have incompatible search modifiers
fixedvsperl/ignore.casebe resolved at the call of these function and not defer to thestr_*calls. Take the following example:In this case, each of the match modifiers set an attribute to
TRUE, though they are incompatible. If one were to examinepatternas is done in the example, the effects are unclear as they will be resolved later. A better method would have successive calls to the modifiers adjustpatternas appropriate. This can be done changing the functions. For example,fixedmight become:Or
perl = FALSEas another alternative.