str_detect_all: Detect any or all patterns.

View source: R/detect.R

str_detect_allR Documentation

Detect any or all patterns.

Description

Vectorized over string.

Usage

str_detect_all(string, pattern, negate = FALSE)

str_detect_any(string, pattern, negate = FALSE)

Arguments

string

A character vector.

pattern

A character vector. The patterns to look for. Default is stringi-style regular expression. stringr::coll() and stringr::fixed() are also permissible.

negate

A flag. If TRUE, inverts the result.

Value

A character vector.

Examples

str_detect_all("quick brown fox", c("x", "y", "z"))
str_detect_all(c(".", "-"), ".")
str_detect_all(c(".", "-"), coll("."))
str_detect_all(c(".", "-"), coll("."), negate = TRUE)
str_detect_all(c(".", "-"), c(".", ":"))
str_detect_all(c(".", "-"), coll(c(".", ":")))
str_detect_all("xyzabc", c("a", "c", "z"))
str_detect_all(c("xyzabc", "abcxyz"), c(".b", "^x"))

str_detect_any("quick brown fox", c("x", "y", "z"))
str_detect_any(c(".", "-"), ".")
str_detect_any(c(".", "-"), coll("."))
str_detect_any(c(".", "-"), coll("."), negate = TRUE)
str_detect_any(c(".", "-"), c(".", ":"))
str_detect_any(c(".", "-"), coll(c(".", ":")))
str_detect_any(c("xyzabc", "abcxyz"), c(".b", "^x"))


strex documentation built on Nov. 2, 2023, 6:04 p.m.