This documentation is archived and is not being maintained.

Regex.GetGroupNames Method

Returns an array of capturing group names for the regular expression.

[Visual Basic]
Public Function GetGroupNames() As String()
public string[] GetGroupNames();
public: String* GetGroupNames()  __gc[];
public function GetGroupNames() : String[];

Return Value

A string array of group names.


The collection of group names contains the set of strings used to name capturing groups in the expression. Even if capturing groups are not explicitly named, they are automatically assigned numerical names (1, 2, 3, and so on). Therefore, this collection can be used to determine the number of groups.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

Regex Class | Regex Members | System.Text.RegularExpressions Namespace