title: Reading capture groups from Regex which are also URL rewrite rules? possible?
body: <p>Given a URL rewrite rule like the following:</p>
  
  <pre><code> &lt;rule name="RewriteUserFriendlyThings" stopProcessing="true"&gt;
          &lt;match url="^cat/sub-cat/(\d+)/([^/]+)/?$" /&gt;
          &lt;conditions&gt;
            &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
            &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
          &lt;/conditions&gt;
          &lt;action type="Rewrite" url="cat/sub-cat/detail.aspx?id={R:2}" /&gt;
        &lt;/rule&gt;
  </code></pre>
  
  <p>In C# code I need to read out the value in the second group of the pattern (which is my ID) for my Bookmark button (don't ask) to work with pages that are dynamic like this. I'm using a certain CMS which does things at publish time, and we missed out bookmarking dynamic content.</p>
  
  <p>So what I've done is load the web.config as XML and match the current URL based on what is in the <code>url</code> attribute of the <code>match</code> element. However, I can't figure out how to get at the group. Bearing in mind this needs to be generic so in another rule the group could be the third or first group.</p>
  
  <p>I have a white list of rules which I do this against. </p>
  
  <p>I tried using Capture Groups <code>(?&lt;id&gt;\d+)</code> but the web.config doesn't allow them.</p>