title: Regex to match on capital letter, digit or capital, lowercase, and digit
body: <p>I'm working on an application which will calculate molecular weight and I need to separate a string into the different molecules. I've been using a regex to do this but I haven't quite gotten it to work. 
  I need the regex to match on patterns like H2OCl4 and Na2H2O where it would break it up into matches like:</p>
  
  <ol>
  <li>H2</li>
  <li>O</li>
  <li>Cl4</li>
  </ol>
  
  <hr>
  
  <ol>
  <li>Na2</li>
  <li>H2</li>
  <li>O</li>
  </ol>
  
  <p>The regex i've been working on is this:</p>
  
  <pre><code>([A-Z]\d*|[A-Z]*[a-z]\d*)
  </code></pre>
  
  <p>It's really close but it currently breaks the matches into this:</p>
  
  <ol>
  <li>H2</li>
  <li>O</li>
  <li>C</li>
  <li>l4</li>
  </ol>
  
  <p>I need the Cl4 to be considered one match. Can anyone help me with the last part i'm missing in this. I'm pretty new to regular expressions. Thanks.</p>