TPerlRegExMatchedOffset (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses the TPerlRegEx MatchedOffset property. This example assumes you placed a TLabel and a TPerlRegEx on a form, and that PerlRegEx.Subject is set to a meaningful test string.

Code

with PerlRegEx1 do begin
  RegEx := 'Bye';
  if Match then Label1.Caption := 'Before typing "Bye", you typed: ' +
    Copy(Subject, 1, MatchedOffset-1);
end;

Uses