System.RegularExpressions.TGroupCollection

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

TGroupCollection = record

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() {}
};

プロパティ

種類 可視性 ソース ユニット
record
struct
public
System.RegularExpressions.pas
System.RegularExpressions.hpp
System.RegularExpressions System.RegularExpressions

説明

1 つの正規表現と一致した結果のグループの集合です。

TGroupCollection にはパブリックなコンストラクタがありません。 TGroupCollection のインスタンスは、System.RegularExpressions.TRegEx.Match の呼び出しの中で作成され、System.RegularExpressions.TMatch.Groups の呼び出しの中でアクセスされます。

1 つの正規表現パターンに複数のサブパターンが含まれている場合があります。サブパターンは、その正規表現の一部をかっこで囲むことによって定義されています。 このようなサブパターンは、それぞれ 1 つのサブ表現(グループ)を検出します。 たとえば、正規表現パターン (\d{3})-(\d{2})-(\d{4}) は、社会保障番号と一致します。 第 1 グループは最初の 3 桁で構成され、この正規表現の (\d{3}) の部分によって検出されます。 2 桁の第 2 グループは、この正規表現の (\d{2}) の部分、第 3 グループは (\d{4}) の部分によって検出されます。 この正規表現を利用して、正しい書式の社会保障番号に System.RegularExpressions.TRegEx.Match を実行すると、これら 3 つのグループを TGroupCollection オブジェクトから取得できます。このオブジェクトは、System.RegularExpressions.TMatch.Groups プロパティによって返されます。 個々の TGroup は、Item 配列から取得できます。 その内容は、TGroup の Value プロパティに保持されています。

関連項目