System.RegularExpressions.TGroupCollection
Delphi
TGroupCollection = record
private
FList: TArray<TGroup>;
FNotifier: IInterface;
constructor Create(const ANotifier: IInterface; const AValue: string;
AIndex, ALength: Integer; ASuccess: Boolean);
function GetCount: Integer;
function GetItem(const Index: Variant): TGroup;
public
function GetEnumerator: TGroupCollectionEnumerator;
property Count: Integer read GetCount;
property Item[const Index: Variant]: TGroup read GetItem; default;
end;
C++
struct DECLSPEC_DRECORD TGroupCollection
{
public:
TGroup operator[](const System::Variant Index) { return this->Item[Index]; }
private:
#ifndef _WIN64
System::DynamicArray<TGroup> FList;
#else /* _WIN64 */
System::TArray__1<TGroup> FList;
#endif /* _WIN64 */
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 System::Variant &Index);
public:
TGroupCollectionEnumerator* __fastcall GetEnumerator();
__property int Count = {read=GetCount};
__property TGroup Item[const System::Variant Index] = {read=GetItem};
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.