System.Text.RegularExpressions.Regex.GroupNameFromNumber C# (CSharp) Method

GroupNameFromNumber() public method

public GroupNameFromNumber ( int i ) : string
i int
return string
        public string GroupNameFromNumber(int i)
        {
            throw null;
        }

Usage Example

        /// <summary>
        /// 
        /// </summary>
        /// <param name="source"></param>
        /// <param name="matchPattern"></param>
        /// <param name="wantInitialMatch"></param>
        /// <returns></returns>
        public static ArrayList ExtractGroupings(string source, string matchPattern, bool wantInitialMatch)
        {
            ArrayList keyedMatches = new ArrayList();
            int startingElement = 1;
            if (wantInitialMatch)
            {
                startingElement = 0;
            }

            Regex RE = new Regex(matchPattern, RegexOptions.Multiline);
            MatchCollection theMatches = RE.Matches(source);

            foreach (Match m in theMatches)
            {
                Hashtable groupings = new Hashtable();

                for (int counter = startingElement;
                  counter < m.Groups.Count; counter++)
                {
                    // If we had just returned the MatchCollection directly, the
                    //  GroupNameFromNumber method would not be available to use
                    groupings.Add(RE.GroupNameFromNumber(counter),
                                   m.Groups[counter]);
                }

                keyedMatches.Add(groupings);
            }

            return (keyedMatches);
        }
All Usage Examples Of System.Text.RegularExpressions.Regex::GroupNameFromNumber