TPerlRegExMatchedText (Delphi)
Description
This example uses the MatchedText property. This example assumes that you have placed a TLabel on a form, made a global TPerlRegEx variable and instantiated it in init code.
Code
procedure TForm1.Button1Click(Sender: TObject);
begin
with PerlRegEx1 do begin
RegEx := 'Windows|Linux'; // Matches 'Windows' or 'Linux', whichever comes first
if Match then Label1.Caption := MatchedText + ' came first!';
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
PerlRegEx1:= TPerlRegEx.Create;
PerlRegEx1.Subject := 'This is a Linux or a Windows App.';
end;