Groups are not capturing what I expect in C# regex. Here is a very simple example:
var matches = Regex.Matches("abcdededefgh","(abc)(de)*(fgh)");
I thought this would capture abc, dededede and fgh as 3 separate groups, since each has a separate set of parentheses. It does, but it also captures the whole string as a group (as the first captured group of four). Given that I don't have a parentheses around the whole pattern (i.e. my pattern is not "((abc)(de)*(fgh))"), I don't understand why the extra group is being captured. This makes it confusing for me to predict the behavior and determine which group I can expect to correspond to what portion of the string.
Also, note that the following has the same 4 group result, so the fact that the "0 to many" asterisk is outside the group parentheses in the above example does not seem to impact the result.
var matches = Regex.Matches("abcdededefgh","(abc)((?:de)*)(fgh)");
Many thanks for any assistance!