library(stringr)x <- "abc[[+de.f[-[[g"str_extract_all(x, "[a-z.]+|\\[+|[+-]")
Standard input is empty
[[1]] [1] "abc" "[[" "+" "de.f" "[" "-" "[[" "g"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!