title: Capture multiple substrings in one group
body: <p>Now, I have a folder path will contain a database table name and a ID, looks like:</p>
  
  <pre><code>path = '/something/else/TableName/000/123/456/789'
  </code></pre>
  
  <p>Of course I can match <code>TableName/000/123/456/789</code> then split them by python script.</p>
  
  <pre><code>import re
  matched = re.findall(r'.*?/(\w+(?:/\d+){4})', path)[0]  # TableName/000/123/456/789
  split_text = matched.split('/')  # ['TableName', '000', '123', '456', '789']
  table_name = split_text[0]  # 'TableName'
  id = int(''.join(split_text[1:]))  # 123456789
  </code></pre>
  
  <p><a href="https://regex101.com/r/Fy7N15/1" rel="nofollow noreferrer">.*?/(\w+(?:/\d+){4})</a></p>
  
  <p>But I want to know, if there any function provided by regex can finish it in one step? I've tried these ways:</p>
  
  <pre><code>re.match(r'.*?/(?P&lt;table_name&gt;\w+)(?:/(?P&lt;id&gt;\d+)){4}', path).groupdict()  # {'table_name': 'TableName', 'id': '789'}
  re.split(r'.*?/(\w+)(?:/(\d+)){4}', path)  # ['', 'TableName', '789', '']
  re.sub(r'(.*?/)\w+(?:(/)\d+){4}', '', path)  # '', full string has been replaced
  </code></pre>
  
  <p><a href="https://regex101.com/r/Fy7N15/2" rel="nofollow noreferrer">.*?/(?P\w+)(?:/(?P\d+)){4}</a></p>
  
  <p><a href="https://regex101.com/r/Fy7N15/3" rel="nofollow noreferrer">.*?/(\w+)(?:/(\d+)){4}</a></p>
  
  <p>Is there anyway else? Or I must use the python script above? I hope the result is <code>{'table_name': 'TableName', 'id': '000123456789'}</code> or <code>('TableName', '000123456789')</code>, at least <code>('TableName', '000', '123', '456', '789')</code>.</p>