• TPerlRegEx


    type
      TPerlRegEx = class(TComponent)
      public
        constructor Create(AOwner: TComponent); override;
        destructor Destroy; override;

        //
    此函数可以自动为特殊字符加转义符号 \
        class function EscapeRegExChars(const S: string): string;

        //
    编译表达式,编译后会加快执行速度,降低启动速度,如果表达式比较复杂而又多次执行,应该先编译
        procedure Compile;

        //
    此方法会检查是否编译,如果没编译刚执行编译
        procedure Study;

        //
    查找函数
        function Match: Boolean;

        //
    查找下一个函数
        function MatchAgain: Boolean;

        //
    替换
        function Replace: PCREString;

        //
    执行全部替换
        function ReplaceAll: Boolean;
        function ComputeReplacement: PCREString;
        procedure StoreSubExpressions;
        function NamedSubExpression(const SEName: PCREString): Integer;

        //
    字符串分割,参数1放分割后的字符串,参数2是分成多少份,给一个较大值为能分多少份就是多少
        procedure Split(Strings: TStrings; Limit: Integer);
        property Compiled: Boolean read FCompiled;

        //
    有没有找到的标记
        property FoundMatch: Boolean read GetFoundMatch;
        property Studied: Boolean read FStudied;

        //
    显示找到的字符
        property MatchedExpression: PCREString read GetMatchedExpression;

        //
    找到的字符串长度
        property MatchedExpressionLength: Integer read GetMatchedExpressionLength;

        //
    找到的字符串所在位置
        property MatchedExpressionOffset: Integer read GetMatchedExpressionOffset;

        //
    设定搜索范围: StartStop  1开始
        property Start: Integer read FStart write SetStart;
        property Stop: Integer read FStop write SetStop;


        property State: TPerlRegExState read FState write FState;

        //
    子表达式的个数
        property SubExpressionCount: Integer read GetSubExpressionCount;

        //[0], [1], [n]
    储存第N个表达式匹配的内容
        property SubExpressions[Index: Integer]: PCREString read GetSubExpressions;

        //[0], [1], [n]
    储存第N个表达式匹配的长度
        property SubExpressionLengths[Index: Integer]: Integer read GetSubExpressionLengths;

        //[0], [1], [n]
    储存第N个表达式匹配的位置
        property SubExpressionOffsets[Index: Integer]: Integer read GetSubExpressionOffsets;

        //
    这是要替换的源字符串
        property Subject: PCREString read FSubject write SetSubject;
        property SubjectLeft: PCREString read GetSubjectLeft;
        property SubjectRight: PCREString read GetSubjectRight;
      published
        //
    可以设定一些选项,比如是否区分大小写
        property Options: TPerlRegExOptions read FOptions write SetOptions;

        //
    这是表达式, 在这里是准备替换掉的子串
        property RegEx: PCREString read FRegEx write SetRegEx;

        //
    要替换成的新串
        property Replacement: PCREString read FReplacement write FReplacement;

        property OnMatch: TNotifyEvent read FOnMatch write FOnMatch;
        property OnReplace: TPerlRegExReplaceEvent read FOnReplace write FOnReplace;
      end;

  • 相关阅读:
    android 连接wifi案例
    eclipse安装web插件
    SpringBoot 传入JSON对象参数
    彻底解决unable to find valid certification path to requested target
    创建Spring boot project报错:Project build error: Non-resolvable parent POM for xxx:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent
    eclipse创建springboot项目的三种方法
    VS中使用svn注意事项
    产品经理岗位说明书
    关于C#单例Singleton的看法和使用
    iframe中跨域页面访问parent的方法
  • 原文地址:https://www.cnblogs.com/w413133157/p/1727117.html
Copyright © 2020-2023  润新知