str_split_2 | R Documentation |
Splits the string but keeps the delimiter. Adopted from https://www.statworx.com/de/blog/strsplit-but-keeping-the-delimiter/.
str_split_2(x, split, type = "remove", perl = FALSE, ...)
x |
A character vector or string |
split |
What to split the string by |
type |
Select one of |
perl |
Extended results expresions are the default |
... |
Other arguments |
A regular expression is a pattern that describes a set of strings. Two types of regular expressions are used in R, extended regular expressions (the default) and Perl-like regular expressions used by perl = TRUE. There is a also fixed = TRUE which can be considered to use a literal regular expression.
A list of characters
x <- c("3D/MON&SUN")
str_split_2(x, "(?<=.)(?=[/&])",perl = TRUE)
a <- c("asdasd.sss","segssddfge.sss","se.sss")
str_split_2(x = a, split = "[.]", type = "remove", perl = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.