Dann lese doch einfach die Datei in einen String und verwende PosEx. So etwa:
Delphi-Quellcode:
function FileToString(aFileName : String) : String;
Var
m : TMemoryStream;
s : TStringStream;
Begin
m := TMemoryStream.Create;
Try
m.LoadFromFile (aFilename);
s := TStringStream.Create('');
Try
s.CopyFrom(m,0);
result := s.DataString;
finally
s.free
end
finally
m.free
end
end;
function FilePosEx(aFileName : String; aSearchString : String; aStartPos : Integer = 1) : Integer;
Var
contents : String;
Begin
contents := FileToString (aFilename);
result := PosEx(aSearchString, contents, aStartPos);
End;
Getippt und ungetestet.