System.RegularExpressions.TGroup

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

  TGroup = record
  private
    FIndex: Integer;
    FLength: Integer;
    FSuccess: Boolean;
    FValue: string;
    constructor Create(const AValue: string; AIndex, ALength: Integer; ASuccess: Boolean);
    function GetValue: string;
  public
    property Index: Integer read FIndex;
    property Length: Integer read FLength;
    property Success: Boolean read FSuccess;
    property Value: string read GetValue;
  end;

C++

struct DECLSPEC_DRECORD TGroup
{
private:
    int FIndex;
    int FLength;
    bool FSuccess;
    System::UnicodeString FValue;
protected:
    __fastcall TGroup(const System::UnicodeString AValue, int AIndex, int ALength, bool ASuccess);
private:
    System::UnicodeString __fastcall GetValue();
public:
    __property int Index = {read=FIndex};
    __property int Length = {read=FLength};
    __property bool Success = {read=FSuccess};
    __property System::UnicodeString Value = {read=GetValue};
    TGroup() {}
};

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 match with a portion of the single regular expression.

TGroup has no public constructor. Instances of TGroup are created in a call to System.RegularExpressions.TRegEx.Match.

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