title: Regex named capture groups in Delphi XE
body: <p>I have built a match pattern in RegexBuddy which behaves exactly as I expect. But I cannot transfer this to Delphi XE, at least when using the latest built in TRegEx or TPerlRegEx.</p>
  
  <p>My real world code have 6 capture group but I can illustrate the problem in an easier example. This code gives "3" in first dialog and then raises an exception (-7 index out of bounds) when executing the second dialog.</p>
  
  <pre><code>var
    Regex: TRegEx;
    M: TMatch;
  begin
    Regex := TRegEx.Create('(?P&lt;time&gt;\d{1,2}:\d{1,2})(?P&lt;judge&gt;.{1,3})');
    M := Regex.Match('00:00  X1 90  55KENNY BENNY');
    ShowMessage(IntToStr(M.Groups.Count));
    ShowMessage(M.Groups['time'].Value);
  end;
  </code></pre>
  
  <p>But if I use only one capture group</p>
  
  <pre><code>Regex := TRegEx.Create('(?P&lt;time&gt;\d{1,2}:\d{1,2})');
  </code></pre>
  
  <p>The first dialog shows "2" and the second dialog will show the time "00:00" as expected.</p>
  
  <p>However this would be a bit limiting if only one named capture group was allowed, but thats not the case... If I change the capture group name to for example "atime".</p>
  
  <pre><code>var
    Regex: TRegEx;
    M: TMatch;
  begin
    Regex := TRegEx.Create('(?P&lt;atime&gt;\d{1,2}:\d{1,2})(?P&lt;judge&gt;.{1,3})');
    M := Regex.Match('00:00  X1 90  55KENNY BENNY');
    ShowMessage(IntToStr(M.Groups.Count));
    ShowMessage(M.Groups['atime'].Value);
  end;
  </code></pre>
  
  <p>I'll get "3" and "00:00", just as expected. Is there reserved words I cannot use? I don't think so because in my real example I've tried completely random names. I just cannot figure out what causes this behaviour.</p>