System.RegularExpressions.TRegEx

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

  TRegEx = record
  private
    FOptions: TRegExOptions;
    FMatchEvaluator: TMatchEvaluator;
    FNotifier: IInterface;
    FRegEx: TPerlRegEx;
    procedure InternalOnReplace(Sender: TObject; var ReplaceWith: string);
  public
    constructor Create(const Pattern: string; Options: TRegExOptions = [roNotEmpty]);
    function IsMatch(const Input: string): Boolean; overload;
    function IsMatch(const Input: string; StartPos: Integer): Boolean; overload;
    class function IsMatch(const Input, Pattern: string): Boolean;overload; static;
    class function IsMatch(const Input, Pattern: string; Options: TRegExOptions): Boolean; overload; static;
    class function Escape(const Str: string; UseWildCards: Boolean = False): string; static;
    function Match(const Input: string): TMatch; overload;
    function Match(const Input: string; StartPos: Integer): TMatch; overload;
    function Match(const Input: string; StartPos, Length: Integer): TMatch; overload;
    class function Match(const Input, Pattern: string): TMatch; overload; static;
    class function Match(const Input, Pattern: string; Options: TRegExOptions): TMatch; overload; static;
    function Matches(const Input: string): TMatchCollection; overload;
    function Matches(const Input: string; StartPos: Integer): TMatchCollection; overload;
    class function Matches(const Input, Pattern: string): TMatchCollection; overload; static;
    class function Matches(const Input, Pattern: string; Options: TRegExOptions): TMatchCollection; overload; static;
    function Replace(const Input, Replacement: string): string; overload;
    function Replace(const Input: string; Evaluator: TMatchEvaluator): string; overload;
    function Replace(const Input, Replacement: string; Count: Integer): string; overload;
    function Replace(const Input: string; Evaluator: TMatchEvaluator; Count: Integer): string; overload;
    class function Replace(const Input, Pattern, Replacement: string): string; overload; static;
    class function Replace(const Input, Pattern: string; Evaluator: TMatchEvaluator): string; overload; static;
    class function Replace(const Input, Pattern, Replacement: string; Options: TRegExOptions): string; overload; static;
    class function Replace(const Input, Pattern: string; Evaluator: TMatchEvaluator; Options: TRegExOptions): string; overload; static;
    function Split(const Input: string): TArray<string>; overload; inline;
    function Split(const Input: string; Count: Integer): TArray<string>; overload; inline;
    function Split(const Input: string; Count, StartPos: Integer): TArray<string>; overload;
    class function Split(const Input, Pattern: string): TArray<string>; overload; static;
    class function Split(const Input, Pattern: string; Options: TRegExOptions): TArray<string>; overload; static;
  end;

C++

struct DECLSPEC_DRECORD TRegEx
{
private:
    TRegExOptions FOptions;
    TMatchEvaluator FMatchEvaluator;
    System::_di_IInterface FNotifier;
    System::Regularexpressionscore::TPerlRegEx* FRegEx;
    void __fastcall InternalOnReplace(System::TObject* Sender, System::UnicodeString &ReplaceWith);
public:
    __fastcall TRegEx(const System::UnicodeString Pattern, TRegExOptions Options);
    bool __fastcall IsMatch(const System::UnicodeString Input)/* overload */;
    bool __fastcall IsMatch(const System::UnicodeString Input, int StartPos)/* overload */;
    static bool __fastcall IsMatch(const System::UnicodeString Input, const System::UnicodeString Pattern)/* overload */;
    static bool __fastcall IsMatch(const System::UnicodeString Input, const System::UnicodeString Pattern, TRegExOptions Options)/* overload */;
    static System::UnicodeString __fastcall Escape(const System::UnicodeString Str, bool UseWildCards = false);
    TMatch __fastcall Match(const System::UnicodeString Input)/* overload */;
    TMatch __fastcall Match(const System::UnicodeString Input, int StartPos)/* overload */;
    TMatch __fastcall Match(const System::UnicodeString Input, int StartPos, int Length)/* overload */;
    static TMatch __fastcall Match(const System::UnicodeString Input, const System::UnicodeString Pattern)/* overload */;
    static TMatch __fastcall Match(const System::UnicodeString Input, const System::UnicodeString Pattern, TRegExOptions Options)/* overload */;
    TMatchCollection __fastcall Matches(const System::UnicodeString Input)/* overload */;
    TMatchCollection __fastcall Matches(const System::UnicodeString Input, int StartPos)/* overload */;
    static TMatchCollection __fastcall Matches(const System::UnicodeString Input, const System::UnicodeString Pattern)/* overload */;
    static TMatchCollection __fastcall Matches(const System::UnicodeString Input, const System::UnicodeString Pattern, TRegExOptions Options)/* overload */;
    System::UnicodeString __fastcall Replace(const System::UnicodeString Input, const System::UnicodeString Replacement)/* overload */;
    System::UnicodeString __fastcall Replace(const System::UnicodeString Input, TMatchEvaluator Evaluator)/* overload */;
    System::UnicodeString __fastcall Replace(const System::UnicodeString Input, const System::UnicodeString Replacement, int Count)/* overload */;
    System::UnicodeString __fastcall Replace(const System::UnicodeString Input, TMatchEvaluator Evaluator, int Count)/* overload */;
    static System::UnicodeString __fastcall Replace(const System::UnicodeString Input, const System::UnicodeString Pattern, const System::UnicodeString Replacement)/* overload */;
    static System::UnicodeString __fastcall Replace(const System::UnicodeString Input, const System::UnicodeString Pattern, TMatchEvaluator Evaluator)/* overload */;
    static System::UnicodeString __fastcall Replace(const System::UnicodeString Input, const System::UnicodeString Pattern, const System::UnicodeString Replacement, TRegExOptions Options)/* overload */;
    static System::UnicodeString __fastcall Replace(const System::UnicodeString Input, const System::UnicodeString Pattern, TMatchEvaluator Evaluator, TRegExOptions Options)/* overload */;
#ifndef _WIN64
    System::DynamicArray<System::UnicodeString> __fastcall Split(const System::UnicodeString Input)/* overload */;
    System::DynamicArray<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, int Count)/* overload */;
    System::DynamicArray<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, int Count, int StartPos)/* overload */;
    static System::DynamicArray<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, const System::UnicodeString Pattern)/* overload */;
    static System::DynamicArray<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, const System::UnicodeString Pattern, TRegExOptions Options)/* overload */;
#else /* _WIN64 */
    System::TArray__1<System::UnicodeString> __fastcall Split(const System::UnicodeString Input)/* overload */;
    System::TArray__1<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, int Count)/* overload */;
    System::TArray__1<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, int Count, int StartPos)/* overload */;
    static System::TArray__1<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, const System::UnicodeString Pattern)/* overload */;
    static System::TArray__1<System::UnicodeString> __fastcall Split(const System::UnicodeString Input, const System::UnicodeString Pattern, TRegExOptions Options)/* overload */;
#endif /* _WIN64 */
    TRegEx() {}
};

Properties

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

Description

A record for handling regular expressions.

TRegEx calls the TPerlRegEx functions that interface with the open source PCRE library.

See Also