System.RegularExpressions.TMatch

Aus RAD Studio API Documentation
Wechseln zu: Navigation, Suche

Delphi

  TMatch = record
  private
    FGroup: TGroup;
    FGroups: TGroupCollection;
    FNotifier: IInterface;
    constructor Create(const ANotifier: IInterface; const AValue: string;
      AIndex, ALength: Integer; ASuccess: Boolean);
    function GetIndex: Integer;
    function GetGroups: TGroupCollection;
    function GetLength: Integer;
    function GetSuccess: Boolean;
    function GetValue: string;
  public
    function NextMatch: TMatch;
    function Result(const Pattern: string): string;
    property Groups: TGroupCollection read GetGroups;
    property Index: Integer read GetIndex;
    property Length: Integer read GetLength;
    property Success: Boolean read GetSuccess;
    property Value: string read GetValue;
  end;

C++

struct DECLSPEC_DRECORD TMatch
{
private:
    TGroup FGroup;
    TGroupCollection FGroups;
    System::_di_IInterface FNotifier;
protected:
    __fastcall TMatch(const System::_di_IInterface ANotifier, const System::UnicodeString AValue, int AIndex, int ALength, bool ASuccess);
private:
    int __fastcall GetIndex();
    TGroupCollection __fastcall GetGroups();
    int __fastcall GetLength();
    bool __fastcall GetSuccess();
    System::UnicodeString __fastcall GetValue();
public:
    TMatch __fastcall NextMatch();
    System::UnicodeString __fastcall Result(const System::UnicodeString Pattern);
    __property TGroupCollection Groups = {read=GetGroups};
    __property int Index = {read=GetIndex};
    __property int Length = {read=GetLength};
    __property bool Success = {read=GetSuccess};
    __property System::UnicodeString Value = {read=GetValue};
    TMatch() {}
};

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
record
struct
public
System.RegularExpressions.pas
System.RegularExpressions.hpp
System.RegularExpressions System.RegularExpressions

Beschreibung

Ein Record mit den Ergebnissen eines einzelnen Vergleichs eines regulären Ausdrucks.

TMatch hat keinen public-Konstruktor. TMatch wird von Methoden, wie System.RegularExpressions.TRegEx.Match, als Rückgabewert erstellt, der die erste Musterübereinstimmung in einem String repräsentiert. TMatch ist auch der Rückgabewert von NextMatch. System.RegularExpressions.TRegEx.Matches gibt eine TMatchCollection zurück, die alle gefundenen Übereinstimmungen enthält.

Wenn ein Mustervergleich erfolgreich ist, enthält die Eigenschaft Value den verglichenen Substring, die Eigenschaft Index die nullbasierte Position des verglichenen Substrings im Eingabe-String und die Eigenschaft Length die Länge des verglichenen Substrings im Eingabe-String.

Da an einem einzigen Vergleich mehrere Erfassungsgruppen beteiligt sein können, verfügt TMatch über die Eigenschaft Groups vom Typ TGroupCollection.

Siehe auch