hadley/stringr — Issue #14: Problem with str_detect and perl pattern
Author: mmarcinmichal
Created: 2011-12-01 17:52:49+00:00
State: open

This function working based on grepl function . But in your interface
(str_detect) I can't find solutions with using extend POSIX i.e perl =
FALSE, value = FALSE.

Suppose I need detect simple string like a:

s1 <- paste("(?!NEGATE_TERMS_I_DONT_HAVE_IT) term1 term2", sep="")

When I trying use:

isDetect <- str_detect("string to match", s1)

I getting error:

Error in grepl("(?!NEGATE_TERMS_I_DONT_HAVE_IT) term1 term2", "Sd",
fixed = FALSE, :
invalid regular expression '(?!NEGATE_TERMS_I_DONT_HAVE_IT) term1 term2'
In addition: Warning message:
In grepl("(?!NEGATE_TERMS_I_DONT_HAVE_IT) term1 term2", "Sd", fixed = FALSE, :
regcomp error: 'Invalid regexp'

And i must use standard grepl function

isDetect <- grepl(s1, "string to match", TRUE, TRUE)

I think will be usefull use in str_detect parameter like perl = FALSE,
value = FALSE.