| StrExtract {DescTools} | R Documentation |
Extract a part of a string, defined as regular expression.
StrExtract(x, pattern, ...)
x |
a character vector where matches are sought, or an object which can be coerced by |
pattern |
character string containing a regular expression (or character string for |
... |
the dots are passed to the the internally used function |
The function wraps regexpr and regmatches.
A character vector.
Andri Signorell <andri@signorell.net>
txt <- c("G1:E001", "No points here", "G2:E002", "G3:E003", NA)
# extract everything after the :
StrExtract(x=txt, pattern=":.*")