TPerlRegExReplace (Delphi)
Description
This example uses the TPerlRegEx Replace method. Place a TButton on the form. Since TPerlRegEx is not a component, make a TPerlRegEx a global variable and then instantiate it in init code.
Code
procedure TForm1.Button1Click(Sender: TObject);
begin
with PerlRegEx1 do begin
Subject := 'Bill loves Hillary';
RegEx := 'Hillary';
Replacement := 'Monica';
if Match then Replace;
ShowMessage(Subject); // "Bill loves Monica"
end;
end;