title: How to get matched index of a regex for all occurences
body: <p>I have a string</p>
  <p><code>CO12dadaCO2dafdCO345daaf</code></p>
  <p>I want to extract all occurences of CO followed by some digits <code>/CO(\d*)([\s\S]*)/</code>, up to another CO.</p>
  <p>In this case I want to get the output:</p>
  <p><code>['CO12dada', 'CO2dafd', 'CO345daaf']</code></p>
  <p>The above regex I tried also matches the rest of the CO's at once so it doesn't work.</p>
  <p>I could get the index of a regex for the first match using <code>str.search</code>, but I need the indexes of a regex for all occurrences.</p>