str_like() and str_like() follow the conventions of the SQL LIKE
and ILIKE operators, namely:
Must match the entire string.
_matches a single character (like.).%matches any number of characters (like.*).\%and\_match literal%and_.
The difference between the two functions is their case-sensitivity:
str_like() is case sensitive and str_ilike() is not.
Examples
fruit <- c("apple", "banana", "pear", "pineapple")
str_like(fruit, "app")
#> [1] FALSE FALSE FALSE FALSE
str_like(fruit, "app%")
#> [1] TRUE FALSE FALSE FALSE
str_like(fruit, "APP%")
#> [1] FALSE FALSE FALSE FALSE
str_like(fruit, "ba_ana")
#> [1] FALSE TRUE FALSE FALSE
str_like(fruit, "%apple")
#> [1] TRUE FALSE FALSE TRUE
str_ilike(fruit, "app")
#> [1] FALSE FALSE FALSE FALSE
str_ilike(fruit, "app%")
#> [1] TRUE FALSE FALSE FALSE
str_ilike(fruit, "APP%")
#> [1] TRUE FALSE FALSE FALSE
str_ilike(fruit, "ba_ana")
#> [1] FALSE TRUE FALSE FALSE
str_ilike(fruit, "%apple")
#> [1] TRUE FALSE FALSE TRUE
