Answers for "str_detect regex r"

1

str_detect regex r

x <- c("a.b.c.d", "aeb")
starts_with <- "a.b"

str_detect(x, paste0("^", starts_with))
#> [1] TRUE TRUE
str_detect(x, paste0("^\\Q", starts_with, "\\E"))
#> [1]  TRUE FALSE
Posted by: Guest on June-21-2020
0

str_detect regex r

str_detect("\nX\n", ".X.")
#> [1] FALSE
str_detect("\nX\n", regex(".X.", dotall = TRUE))
#> [1] TRUE
Posted by: Guest on June-21-2020

Browse Popular Code Answers by Language