For a pattern that starts with "pr" following with multiple "r", e.g., pr, prr, pr...r. I would like to split the non-pattern string and ALL pattern strings, without deleting the pattern. strsplit() does the job but deletes all pr..r. However, stringr::str_extract_all extracts patterned strings but non-pattern strings gone.
Is there a way to simply keep all strings but single out patterned strings?
x<-c("zprzzzprrrrrzpzr")
"z" "pr" "zzz" "prrrrr" "zpzr" # desired output; keep original character order