title: How to check if a named capture group exists?
body: <p>In my regex the pattern is something like this:</p>
  
  <pre><code>@"Something\(\d+, ""(.+)""(, .{1,5}, \d+, (?&lt;somename&gt;\d+)?\),"
  </code></pre>
  
  <p>So I would like to know if <code>&lt;somename&gt;</code> exists. If it was a normal capture group, I could just check if the capture groups are greater than the number of groups without that/those capture group(s), but I don't have the option here.</p>
  
  <p>Could anyone help me find a way round this? I don't need it to be efficient, it's just for a one-time program that's used for sorting, so I don't mind if it takes a bit to run. It's not going to be for public code.</p>