TPerlRegExStudy (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses the TPerlRegEx Study method. Depending on what the user entered in Edit1 and Memo1, RegEx might end up being a pretty complicated regular expression that wil be applied to the memo text a great many times. This makes it worthwhile to spend a little extra time studying the regular expression.

Code

with PerlRegEx1 do begin
  RegEx := Edit1.Text;
  Study;
  Subject := Memo1.Lines.Text;
  Replacement := Edit2.Text;
  ReplaceAll;
  Memo1.Lines.Text := Subject;
end;

Uses