使用'|'替换所有的内容
代码:
program Project1; {$APPTYPE CONSOLE} uses
System.SysUtils, System.RegularExpressionsCore; var
reg: TPerlRegEx; begin
try
reg := TPerlRegEx.Create;
with reg do
begin
Subject := 'fafds23423vdadfa';
Writeln('替换前 : ' + Subject);
RegEx := '.';
Replacement := '|';
ReplaceAll;
end;
Writeln('替换后 : ' + reg.Subject);
FreeAndNil(reg);
Readln; except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end; end.
结果: