TPerlRegExReplacement (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses the TPerlRegEx Replacement property. This example will show a messagebox saying "Foo is the name of the bar I like".

Code

with PerlRegEx1 do begin
  Subject := 'I like to hang out at Foo bar';
  RegEx := '([A-Za-z]+) bar';
  Replacement := '\1 is the name of the bar I like';
  if Match then Replace;
  ShowMessage(RegEx.Subject);
end;

Uses