System.RegularExpressions.TMatch

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

TMatch = record

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

Properties

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

Description

A record containing the results of a single regular expression match.

TMatch has no public constructor. TMatch is constructed by methods like System.RegularExpressions.TRegEx.Match as a return value which represents the first pattern match in a string. TMatch is also the return type of NextMatch. System.RegularExpressions.TRegEx.Matches returns a TMatchCollection that contains all matches found.

If a pattern match is successful, the Value property contains the matched substring, the Index property contains the zero-based starting position of the matched substring in the input string, and the Length property contains the length of matched substring in the input string.

Because a single match can involve multiple capturing groups, TMatch has a Groups property that is of type TGroupCollection.

See Also