title: R strsplit: Split based on character except when a specific character follows
body: <p>Say I have a vector of character strings like </p>
  
  <pre><code>split_these = c("File Location:C:\\Documents","File Location:Pete's Computer","File Location:") 
  </code></pre>
  
  <p>I want to split each element in this vector based on ":" except for when a "\" follows it. What I want is for something that returns something like</p>
  
  <pre><code>#preferred solution
  "File Location" "C:\\Documents"
  "File Location" "Pete's Computer"
  "File Location" ""
  </code></pre>
  
  <p>or </p>
  
  <pre><code>#less preferred but still great
  "File Location" "C:\\Documents"
  "File Location" "Pete's Computer"
  "File Location" 
  </code></pre>
  
  <p>I've tried the following </p>
  
  <pre><code>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:"
  </code></pre>