TRegexMatch
From SCAR Divi Manual
Definition
TRegexMatch = record MatchedText: AnsiString; Offset: Integer; Length: Integer; end;
Availability
SCAR Divi 3.25 > Current
Description
A structured type which holds a regex match. MatchedText holds the text that was matched, Offset holds the offset where the match was found and finally Length holds the length of MatchedText.
Example
var
Matches: TRegexMatchArray;
i: Integer;
begin
PregMatchEx('/World\! (\d+)/', 'Hello World! 125', Matches);
for i := Low(Matches) to High(Matches) do
WriteLn('"' + Matches[i].MatchedText + '" at ' + IntToStr(Matches[i].OffSet) +
' with length ' + IntToStr(Matches[i].Length));
end.Output:
"World! 125" at 7 with length 10 "125" at 14 with length 3