strMatch | R Documentation |
Uses regexec()
and regmatches()
internally.
strMatch(x, pattern, fixed = FALSE)
x |
|
pattern |
|
fixed |
|
Expands with NA
values for match failures, like stringi and stringr.
matrix
.
Character matrix of match groups.
Updated 2023-09-25.
regexec()
, regmatches()
, regexpr()
.
stringi::stri_match_first()
.
stringr::str_match()
.
https://stringr.tidyverse.org/articles/from-base.html
https://bookdown.org/rdpeng/rprogdatascience/regular-expressions.html
https://stackoverflow.com/questions/19171715/
https://d-rug.github.io/blog/2015/regex.fick
## Regex match.
object <- strMatch(
x = c("a-b", "c-d", "e_f", NA),
pattern = "^(.+)-(.+)$",
fixed = FALSE
)
print(object)
## Fixed match.
object <- strMatch(
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.