Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Bin/ScriptHelp.rtf
Binary file not shown.
20 changes: 19 additions & 1 deletion Externals/ScriptStringList.pas
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ interface
uses
System.Types,
System.SysUtils,
System.Classes;
System.Classes,
System.Rtti;

type

Expand Down Expand Up @@ -301,6 +302,19 @@ function TScriptStringList.RemoveAllLines(const aStartText: string; aCount: Inte


function TScriptStringList.RegEx(const aPattern: string; const aValue: string; const aOperation: string): Boolean;

function FormatMatchGroups(const aMatch: TMatch): String;
var
LIndex: Integer;
LValues: TArray<TValue>;
begin
SetLength(LValues, aMatch.Groups.Count);
for LIndex := 0 to aMatch.Groups.Count-1 do
LValues[LIndex] := aMatch.Groups[LIndex].Value;

Result := Format(aValue, TValueArrayToArrayOfConst(LValues));
end;

var
LMatch: TMatch;
LValue: string;
Expand All @@ -317,6 +331,9 @@ function TScriptStringList.RegEx(const aPattern: string; const aValue: string; c
else
if SameText(aOperation, 'Append') then
LOperation := 2
else
if SameText(aOperation, 'Format') then
LOperation := 3
else
begin
Result := False;
Expand All @@ -331,6 +348,7 @@ function TScriptStringList.RegEx(const aPattern: string; const aValue: string; c
0: LValue := aValue;
1: LValue := aValue + LMatch.Value;
2 : LValue := LMatch.Value + aValue;
3 : LValue := FormatMatchGroups(lMatch);
end;
try
Self[LIndex] := TRegEx.Replace(Self[LIndex], aPattern, LValue);
Expand Down
Binary file modified ScriptHelp.rtf
Binary file not shown.