Learn R Programming

lares (version 4.8.4)

grepl_letters: Pattern Matching for Letters considering Blanks

Description

Match pattern of letters considering blanks within each element of a character vector, allowing counted characters between and around each letter. Used as an auxiliary function for the Scrabble family of functions.

Usage

grepl_letters(vector, pattern, blank = "_")

Arguments

vector

Character vector

pattern

Character. Character string containing a semi-regular expression which uses the following logic: "a_b" means any character that contains "a" followed by something followed by "b", anywhere in the string.

blank

Character. String to use between letters.

Examples

Run this code
# NOT RUN {
x <- c("aaaa", "bbbb", "abab", "aabb", "a", "ab")
grepl_letters(x, "ab")
grepl_letters(x, "_ab")
grepl_letters(x, "a_a")
grepl_letters(x, "c")
# }

Run the code above in your browser using DataLab