diff --git a/Bin/ScriptHelp.rtf b/Bin/ScriptHelp.rtf index a7fd77d..11b94cd 100644 Binary files a/Bin/ScriptHelp.rtf and b/Bin/ScriptHelp.rtf differ diff --git a/Externals/ScriptStringList.pas b/Externals/ScriptStringList.pas index 024b9e2..01dc6cf 100644 --- a/Externals/ScriptStringList.pas +++ b/Externals/ScriptStringList.pas @@ -60,7 +60,8 @@ interface uses System.Types, System.SysUtils, - System.Classes; + System.Classes, + System.Rtti; type @@ -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; + 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; @@ -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; @@ -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); diff --git a/ScriptHelp.rtf b/ScriptHelp.rtf index a7fd77d..11b94cd 100644 Binary files a/ScriptHelp.rtf and b/ScriptHelp.rtf differ