zoukankan      html  css  js  c++  java
  • Delphi 正则表达式之TPerlRegEx 类的属性与方法(3): Start、Stop

    //设定搜索范围: Start、Stop
    var
      reg: TPerlRegEx;
    begin
      reg := TPerlRegEx.Create(nil);
    
      reg.Subject := 'ababab';
      reg.RegEx   := 'ab';
      reg.Replacement := '◆';
    
      reg.Start := 1;
      reg.Stop := 2;
      while reg.MatchAgain do
      begin
        reg.Replace;
      end;
      ShowMessage(reg.Subject); //返回: ◆abab
    
    
      reg.Subject := 'ababab';
      reg.Start := 3;
      reg.Stop := 4;
      while reg.MatchAgain do
      begin
        reg.Replace;
      end;
      ShowMessage(reg.Subject); //返回: ab◆ab
    
    
      reg.Subject := 'ababab';
      reg.Start := 5;
      reg.Stop := 6;
      while reg.MatchAgain do
      begin
        reg.Replace;
      end;
      ShowMessage(reg.Subject); //返回: abab◆
    
      FreeAndNil(reg);
    end;
    
  • 相关阅读:
    Python3 文件
    Python 字典
    Python OS
    Python函数zip-map
    Python 3.5 filter
    python3.5.2库getpass
    JavaScript学习四
    cocos creator学习
    JavaScript学习三
    JavaScript学习3
  • 原文地址:https://www.cnblogs.com/del/p/1011963.html
Copyright © 2011-2022 走看看