TPerlRegExGroups (Delphi)
Description
This example uses the TPerlRegEx Groups property.
Code
with PerlRegEx1 do begin
RegEx := '(Joe|Jack|William|Avarell) (Dalton)? did it';
Subject := 'The sheriff told us that Joe Dalton did it.';
if Match then
if GroupCount = 2 then
ShowMessage('Wanted: ' + Groups[1] + ' ' + Groups[2])
else
ShowMessage('Wanted: ' + Groups[1] + ' (probably Dalton)');
end;