R Language Splitting text by some fixed pattern


Example

Split vector of texts using one pattern:

stri_split_fixed(c("To be or not to be.", "This is very short sentence.")," ")
# [[1]]
# [1] "To"  "be"  "or"  "not" "to"  "be."
# 
# [[2]]
# [1] "This"      "is"        "very"      "short"     "sentence."

Split one text using many patterns:

stri_split_fixed("Apples, oranges and pineaplles.",c(" ", ",", "s"))
# [[1]]
# [1] "Apples,"     "oranges"     "and"         "pineaplles."
# 
# [[2]]
# [1] "Apples"                   " oranges and pineaplles."
# 
# [[3]]
# [1] "Apple"          ", orange"       " and pineaplle" "."