title: Python Regular Expression Multiple Groups
body: <p>Todo: Use a regular expression to breakdown drives</p>
  
  <pre><code>drives = "8:20-24,30,31,32,10:20-24,30,31,32"
  </code></pre>
  
  <p>Final output will look like this:</p>
  
  <pre><code>formatted_drives = [{8: [20,21,22,23,24,30,31,32]}, {10: [20,21,22,23,24,30,31,32]}]
  </code></pre>
  
  <p>Here is what the regex currently looks like:</p>
  
  <pre><code>    regex_static_multiple_with_singles = re.match(r"""
      (?P&lt;enc&gt;\d{1,3}):       # Enclosure ID:
      (?P&lt;start&gt;\d+)          # Drive Start
      -                       # Range -
      (?P&lt;end&gt;\d+)            # Drive End
      (?P&lt;singles&gt;,\d+)+      # Drive Singles - todo resolve issue here
      """, drives, (re.IGNORECASE | re.VERBOSE))
  </code></pre>
  
  <p>and what is returned:</p>
  
  <pre><code>[DEBUG  ] All Drive Sequences: ['8:20-24,30,31,32', '10:20-24,30,31,32']
  [DEBUG  ] Enclosure ID  : 8
  [DEBUG  ] Drive Start   : 20
  [DEBUG  ] Drive End     : 24
  [DEBUG  ] Drive List    : [20, 21, 22, 23, 24]
  [DEBUG  ] Drive Singles : ,32
  [DEBUG  ] Enclosure ID  : 10
  [DEBUG  ] Drive Start   : 20
  [DEBUG  ] Drive End     : 24
  [DEBUG  ] Drive List    : [20, 21, 22, 23, 24]
  [DEBUG  ] Drive Singles : ,32
  </code></pre>
  
  <p>The issue is with drive singles only returning the last group. In this case there are 3x single drives, however, it is a variable quantity. What is the best method to return all single drives?</p>