title: Splitting string based on intervals
body: <p>I have strings that contain intervals (open/closed/mixed) intervals that are then split by commas. I would then like to split these strings by the commas <em>outside the intervals</em>.</p>
  <p>e.g.</p>
  <pre><code>&quot;(-Inf, 2], (2, 8), [8, 9], (9, 10), [10, Inf)&quot;
  </code></pre>
  <p>would become</p>
  <pre><code>[1] &quot;(-Inf, 2]&quot;
  [2] &quot;(2, 8)&quot;
  [3] &quot;[8, 9]&quot;
  [4] &quot;(9, 10)&quot;
  [5] &quot;[10, Inf)&quot;
  </code></pre>
  <p>I've tried various approaches but can't seem to get it to work for all the interval types.</p>