Skip to content

Instantly share code, notes, and snippets.

@ChrisBeeley
Created August 30, 2022 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisBeeley/70e754930083574b0a12b0328aff6127 to your computer and use it in GitHub Desktop.
Save ChrisBeeley/70e754930083574b0a12b0328aff6127 to your computer and use it in GitHub Desktop.
a <- c("Yes please", "Not this one", "This is also good")

stringr::str_detect(a, "Yes")
#> [1]  TRUE FALSE FALSE

stringr::str_detect(a, "Yes") | stringr::str_detect(a, "good")
#> [1]  TRUE FALSE  TRUE

stringr::str_detect(a, "Yes|good")
#> [1]  TRUE FALSE  TRUE

Created on 2022-08-30 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment