title: RegEx for capturing group not recognized
body: <p>I have the following Regex:</p>
  
  <pre><code>(?:\/(?&lt;root&gt;family-resources|employer-resources|newsroom|text-pages))?\/(?:(?&lt;path&gt;[0-9A-z=\-\s]+\/?)+)
  </code></pre>
  
  <p>As you can see, I'm trying to set up two named capture groups - <code>root</code> and <code>path</code>. However, when running this and checking the match groups, there is no <code>root</code> group - only <code>path</code>. </p>
  
  <p>Using C#:</p>
  
  <pre><code>root = match.Groups["root"]?.Value ?? "Text Pages"; // Returns an empty string as the root group is missing.
  </code></pre>
  
  <p>I was able to reproduce this by running the Regex pattern on <a href="https://regex101.com/" rel="nofollow noreferrer">https://regex101.com/</a>. </p>
  
  <p>If you put in the following test string:</p>
  
  <pre><code>/sitecore/content/Corporate-New/home/employer-resources/back-up-care
  </code></pre>
  
  <p>You'll notice you only get one named capture group back - <code>path</code>.<br>
  Why is <code>root</code> not being returned? </p>
  
  <p>It definitely seems like I'm using the right syntax for a named capture group. I've tried adding parentheses both outside the capture group and inside the regex pattern, and neither worked. I was thinking maybe the Regex pattern wasn't being understood.</p>
  
  <p><a href="https://i.stack.imgur.com/kRHTy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kRHTy.png" alt="regex101 result screenshot"></a></p>