を以下の場合を除き、文字に基づくスプリットは私がに基づいて、このベクトルの各要素を分割したいRのstrsplit:特定の文字は
split_these = c("File Location:C:\\Documents","File Location:Pete's Computer","File Location:")
のような文字列のベクトルを持っていると言う「:」ときを除き、それに続いて "\"が続きます。私が欲しいのは、私は否定先読みアサーションとPCREsを使用することをお勧めし
strsplit(split_these, ":")
[[1]]
[1] "File Location" "C" "\\Documents"
[[2]]
[1] "File Location" "Pete Computer"
[[3]]
[1] "File Location"
strsplit(split_these, ":[^\\]")
[[1]]
[1] "File Location" ":\\Documents"
[[2]]
[1] "File Location" "ete Computer"
[[3]]
[1] "File Location:"