title: How to split a string by nth intervals of alphabetical characters while also separating specific characters?
body: <p>If we have a</p>
  <pre><code>string s = 'abcdxefyghijxlm'
  </code></pre>
  <p>I can split it by 2 characters using</p>
  <pre><code>s.match(/.{1,2}/g)
  </code></pre>
  <p>and I will get</p>
  <pre><code>['ab', 'cd', 'xe', 'fy', 'gh', 'ij', 'xl', 'm']
  </code></pre>
  <p>How would I split it this way while at the same time isolating specific characters <code>'x'</code> and <code>'y'</code>?</p>
  <p>For the example above, I would like to get the following result</p>
  <pre><code>['ab', 'cd', 'x', 'ef', 'y', 'gh', 'ij', 'x', 'lm']
  </code></pre>
  <p><strong>EDIT</strong></p>
  <p>I forgot to mention that I am only targetting alphabetical characters to be split into pairs except <code>x</code> and <code>y</code>. So currently, the regex I have above does not actually work for when I have something like <code>s = '{&quot;abcd&quot;:&quot;12&quot;}'</code> as it will result to</p>
  <pre><code> ['{&quot;', 'ab', 'cd', '&quot;:', '&quot;1, '2&quot;', '}']
  </code></pre>
  <p>instead of</p>
  <pre><code> [ '{', '&quot;', 'ab', 'cd', '&quot;', ':', '&quot;', '1', '2', '&quot;', '}']
  </code></pre>