单元格如[AAA!F12] 的正则表达式:
SDFunFormat:='\[%s\!%s\]';
Result:=format(SDFunFormat,['[\x{4e00}-\x{9fa5}\w\(\)()\x22]*',
'\w*'
]);
SDFunFormat:='%s\!%s%s';
Result:=format(SDFunFormat,['[\x{4e00}-\x{9fa5}\w\(\)()\x22]*',
'[a-zA-Z]*',
'[0-9]*'
]);
逻辑运算符表达式
pattern_base:='[><=\x22]+';
//正则表达式通用匹配函数
function RegFindEx(const AOValue, Apattern: string; var
strlst: TStringList): boolean;
var
Match: TMatch;
Matchs: TMatchCollection;
begin
Result:=false;
strlst.Clear;
if Apattern='' then exit;
if AOValue='' then exit;
Matchs := TRegEx.Matches(AOValue,Apattern);
if Matchs.Count>0 then
begin
for Match in Matchs do
begin
strlst.Add(Match.Value);
end;
Result:=true;
end;
end;