Is there a chance that the message is something like the following?
> check_text_error("No error found")
[1] TRUE
If yes, maybe to explicit that the string start with one of the wordlist is enough, like the following:
check_text_error <- function(
text,
wordlist = c("halt", "err", "terminat", "not found"),
ignore_case = TRUE
) {
grepl(
paste0("^", wordlist, collapse = "|"),
text,
ignore.case = ignore_case
)
}
check_text_error("No error found")
check_text_error("Error: aaa")
Originally posted by @vituri in #15 (comment)