procedure TForm1.BtnSearchSitClick(Sender: TObject);
var direct,filename,afterspace,beforespace:
string;
page:TStringList;
i,j,idx:integer;
re:TRegExpr;
such:Boolean;
begin
direct:=Edpaths.Text;
GetFilesInDirectory(direct,'
*.html',LiBoSit.Items,true,true);
GetFilesInDirectory(direct,'
*.htmlm',LiBoSit.Items,true,false);
//GetFilesInDirectory(direct,'*.jsp',LiBoSit.Items,true,false);
LbSit.Caption:=(IntToStr(LiBoSit.Count));
//routine zum suchen der Url in den htmls
page:=TStringList.Create;
re:=TRegExpr.Create;
try
for i:=0
to LiBoSit.Count-1
do
begin
page.LoadFromFile(LiBoSit.Items[i]);
re.ModifierI:=true;
re.ModifierG:=true;
re.ModifierM:=false;
re.ModifierS:=false;
re.ModifierX:=false;
re.Expression:='
<img .*?src=[\\]??"([^"]*?)[\\]??"';
such:=re.Exec(page.Text);
if such
then
repeat
idx:=LastPos('
/',re.match[1]);
if idx > 0
then filename:=copy(re.Match[1],idx+1,length(re.Match[1]))
else filename:=re.match[1];
idx:=LastPos('
%20',filename);
if idx > 0
then begin
afterspace:=copy(filename,idx+3,length(filename));
beforespace:=copy(filename,0,idx-2);
filename:=beforespace+'
'+afterspace;
end;
LiBoPicsFoundInPages.Items.Add(filename);
until not re.ExecNext;
end;
finally
LiBoPicsFoundInPages.Sorted:=true;
page.Free;
re.Free;
end;
LbPicsFoundInPages.Caption:=(IntToStr(LiBoPicsFoundInPages.Count));
end;