group_vector {baizer} | R Documentation |
group character vector by a regex pattern
Description
group character vector by a regex pattern
Usage
group_vector(x, pattern = "\\w")
Arguments
x |
character vector |
pattern |
regex pattern, '\w' as default |
Value
list
Examples
v <- c(
stringr::str_c("A", c(1, 2, 9, 10, 11, 12, 99, 101, 102)),
stringr::str_c("B", c(1, 2, 9, 10, 21, 32, 99, 101, 102))
) %>% sample()
group_vector(v)
group_vector(v, pattern = "\\w\\d")
group_vector(v, pattern = "\\w(\\d)")
# unmatched part will alse be stored
group_vector(v, pattern = "\\d{2}")
[Package baizer version 0.8.0 Index]