strMatchAll | R Documentation |
Uses gregexec()
and regmatches()
internally.
strMatchAll(x, pattern, fixed = FALSE)
x |
|
pattern |
|
fixed |
|
Expands with NA
values for match failures, like stringi and stringr.
list
.
List of character matrix of match groups.
Updated 2023-09-25.
gregexec()
, regmatches()
, gregexpr()
.
stringi::stri_match_all()
.
stringr::str_match_all()
.
https://stringr.tidyverse.org/articles/from-base.html
## Regex match.
object <- strMatchAll(
x = c("a-b", "c-d", "e_f", NA),
pattern = "^(.+)-(.+)$",
fixed = FALSE
)
print(object)
## Fixed match.
object <- strMatchAll(
x = c("a", "aa", "b", "bb"),
pattern = "a",
fixed = TRUE
)
print(object)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.