标签:style blog http color os ar sp strong div
//设定搜索范围: 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;
Delphi 正则表达式之TPerlRegEx 类的属性与方法(3): Start、Stop
标签:style blog http color os ar sp strong div
原文地址:http://www.cnblogs.com/honeynm/p/4059928.html