O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

GroupCollection

Synopsis

This class is a collection of the captured groups in a regular expression. A GroupCollection is indexed by either a string with the name of the capture group, or with an integer number of the capture group as determined in the regular expression (give a name to a capture group by putting ?<name> immediately after the opening parenthesis). So, Match.Groups ["name"] would retrieve a capture from the subexpression (?<name>expr), and Match.Groups [1] would be the result from the first explicitly grouped subexpression. The entire regular expression is the zero-indexed group (an expression without any groupings is treated as a single group). A GroupCollection is returned by Match.Groups.

public class GroupCollection : ICollection, IEnumerable {
// Public Instance Properties
   public field int Count{get; }                                 // implements ICollection
   public field bool IsReadOnly{get; } 
   public field bool IsSynchronized{get; }                       // implements ICollection
   public field object SyncRoot{get; }                           // implements ICollection
   public field Group this{get; } 
   public field Group this{get; } 
// Public Instance Methods
   public method void CopyTo(Array array, int arrayIndex);      // implements ICollection
   public method IEnumerator GetEnumerator();                    // implements IEnumerable
}

Returned By

Match.Groups

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required