title: Splitting a string into chunks by numeric or alpha character with JavaScript
body: <p>I have this:</p>
  <pre><code>var str = A123B234C456;
  </code></pre>
  <p>I need to split it into comma-separated chunks to return something like this:</p>
  <pre><code>A,123,B,234,c,456
  </code></pre>
  <p>I thought a <a href="https://en.wikipedia.org/wiki/Regular_expression" rel="nofollow noreferrer">regular expression</a> would be best for this, but I keep getting stuck. Essentially, I tried to do a string replace, but you cannot use a regular expression in the second argument.</p>
  <p>I would love to keep it simple and clean and do something like this, but it does not work:</p>
  <pre><code>str = str.replace(/[\d]+/, &quot;,&quot;+/[\d]+/);
  </code></pre>
  <p>But in the real world that would be too simple.</p>
  <p>Is it possible?</p>