System.RegularExpressions.TGroup

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

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

C++

struct DECLSPEC_DRECORD TGroup
{
private:
    int FIndex;
    int FLength;
    bool FSuccess;
#ifndef _WIN64
    System::DynamicArray<System::Byte> FValue;
#else /* _WIN64 */
    System::TArray__1<System::Byte> FValue;
#endif /* _WIN64 */
protected:
    __fastcall TGroup(const System::UnicodeString AValue, int AIndex, int ALength, bool ASuccess);
private:
    int __fastcall GetIndex(void);
    int __fastcall GetLength(void);
    System::UnicodeString __fastcall GetValue(void);
public:
    __property int Index = {read=GetIndex};
    __property int Length = {read=GetLength};
    __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