summaryrefslogtreecommitdiff
path: root/tools.pas
diff options
context:
space:
mode:
Diffstat (limited to 'tools.pas')
-rw-r--r--tools.pas14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools.pas b/tools.pas
index 7a62703..7c7f96d 100644
--- a/tools.pas
+++ b/tools.pas
@@ -9,6 +9,7 @@ uses
type
tAktualitaet = (aNichtVorhanden,aVeraltet,aAktuell,aWirdErneuert);
+ tRegexTyp = (rtKein,rtFpc,rtShell);
tMyStringListBArray = array[boolean] of tMyStringList;
tSummenDatei = record
name: string;
@@ -43,6 +44,7 @@ procedure testeObBefehlLokal(bef, ordner: string; dateiListe: tMyStringList; lok
function extrahiereAlleDateien(woraus: string; dateiListe: tMyStringList): tMyStringList;
function unescape(s: string): string;
function escape(s,toe: string; ec: char): string;
+function escapeStringToRegex(s: string; typ: tRegexTyp; extras: string = ''): string; inline;
procedure ersetzeAlleVorkommen(var worin: string; was,wodurch: string);
// Routinen für sha512-Prüfsummen
@@ -363,6 +365,18 @@ begin
end;
end;
+function escapeStringToRegex(s: string; typ: tRegexTyp; extras: string = ''): string;
+begin
+ case typ of
+ rtKein:
+ result:=s;
+ rtFpc:
+ result:=escape(s,'\.[+^$'+extras,'\');
+ rtShell:
+ result:=escape(s,'\.[^$'+extras,'\');
+ end{of case};
+end;
+
procedure ersetzeAlleVorkommen(var worin: string; was,wodurch: string);
begin
while pos(was,worin)>0 do begin