title: Regexes works on their own, but not when used together in strsplit
body: <p>I'm trying to split a string in R using <code>strsplit</code> and a perl regex. The string consists of various alphanumeric tokens separated by periods or hyphens, e.g <code>"WXYZ-AB-A4K7-01A-13B-J29Q-10"</code>. I want to split the string:</p>
  
  <ul>
  <li>wherever a hyphen appears.</li>
  <li>wherever a period appears.</li>
  <li>between the second and third character of a token that is exactly 3 characters long and consists of 2 digits followed by 1 capital letter, e.g <code>"01A"</code> produces <code>["01", "A"]</code> (but <code>"012A"</code>, <code>"B1A"</code>, <code>"0A1"</code>, and <code>"01A2"</code> are not split).</li>
  </ul>
  
  <p>For example, <code>"WXYZ-AB-A4K7-01A-13B-J29Q-10"</code> should produce <code>["WXYZ", "AB", "01", "A", "13", "B", "J29Q", "10"]</code>.</p>
  
  <p>My current regex is <code>((?&lt;=[-.]\\d{2})(?=[A-Z][-.]))|[.-]</code> and it works perfectly in <a href="https://regex101.com/" rel="nofollow noreferrer">this online regex tester</a>. </p>
  
  <p>Furthermore, the two parts of the alternative, <code>((?&lt;=[-.]\\d{2})(?=[A-Z][-.]))</code> and <code>[.-]</code>, both serve to split the string as intended in R, when they are used separately:</p>
  
  <pre><code>#correctly splits on periods and hyphens
  strsplit("WXYZ-AB-A4K7-01A-13B-J29Q-10", "[.-]", perl=T)
  [[1]]
  [1] "WXYZ" "AB"   "A4K7" "01A"  "13B"  "J29Q" "10"
  
  #correctly splits tokens where a letter follows two digits
  strsplit("WXYZ-AB-A4K7-01A-13B-J29Q-10", "((?&lt;=[-.]\\d{2})(?=[A-Z][-.]))", perl=T)
  [[1]]
  [1] "WXYZ-AB-A4K7-01" "A-13"            "B-J29Q-10"
  </code></pre>
  
  <p>But when I try and combine them using an alternative, the second regex stops working, and the string is only split on periods and hyphens:</p>
  
  <pre><code>#only second alternative is used
  strsplit("WXYZ-AB-A4K7-01A-13B-J29Q-10", "((?&lt;=[-.]\\d{2})(?=[A-Z][-.]))|[.-]", perl=T)
  [[1]]
  [1] "WXYZ" "AB"   "A4K7" "01A"  "13B"  "J29Q" "10"
  </code></pre>
  
  <p>Why is this happening? Is it a problem with my  regex, or with <code>strsplit</code>? How can I achieve the desired behavior? </p>
  
  <h2>Desired output:</h2>
  
  <pre><code>## [[1]]
  ## [1] "WXYZ" "AB"   "A4K7" "01"   "A"    "13"   "B"    "J29Q" "10"
  </code></pre>