System.RegularExpressions.TGroupCollection

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

TGroupCollection = record

C++

struct DECLSPEC_DRECORD TGroupCollection
{
public:
    TGroup operator[](const int Index) { return this->Item[Index]; }
private:
    System::DynamicArray<TGroup> FList;
    System::_di_IInterface FNotifier;
protected:
    __fastcall TGroupCollection(const System::_di_IInterface ANotifier, const System::UnicodeString AValue, int AIndex, int ALength, bool ASuccess);
private:
    int __fastcall GetCount();
    TGroup __fastcall GetItem(const int Index)/* overload */;
    TGroup __fastcall GetItem(const System::UnicodeString Index)/* overload */;
    bool __fastcall GetNamedGroupIndex(const System::UnicodeString Index, /* out */ int &IntIndex);
public:
    bool __fastcall TryGetNamedGroup(const System::UnicodeString Index, /* out */ TGroup &Group);
    bool __fastcall ContainsNamedGroup(const System::UnicodeString Index);
    TGroupCollectionEnumerator* __fastcall GetEnumerator();
    __property int Count = {read=GetCount};
    __property TGroup Item[const int Index] = {read=GetItem};
    TGroup operator[](const System::String Index) { return GetItem(Index); };
    TGroupCollection() {}
};

Properties

Type Visibility Source Unit Parent
record
struct
public
System.RegularExpressions.pas
System.RegularExpressions.hpp
System.RegularExpressions System.RegularExpressions

Description

A collection of groups as the result of a match with a single regular expression.

TGroupCollection has no public constructor. Instances of TGroupCollection are created in a call to System.RegularExpressions.TRegEx.Match and are accessed in a call to System.RegularExpressions.TMatch.Groups.

A regular expression pattern can include subpatterns, which are defined by enclosing a portion of the regular expression pattern in parentheses. Every such subpattern captures a subexpression or group. For example, the regular expression pattern (\d{3})-(\d{2})-(\d{4}), which matches social security numbers. The first group consists of the first three digits and is captured by the first portion of the regular expression, (\d{3}). The second group of two digits is captured by the second portion of the regular expression, (\d{2}), and the third by (\d{4}). After a System.RegularExpressions.TRegEx.Match of a well-formatted social security number with this regular expression, these three groups can then be retrieved from the TGroupCollection object that is returned by the System.RegularExpressions.TMatch.Groups property. An individual TGroup can then be indexed from the Item array. Its contents is kept in the TGroup Value property.

See Also