هذا الكود كامل
procedure TForm1.Button1Click(Sender: TObject);
var
http :TIdHTTP;
reg: IRegExp2;
MatchCollection: IMatchCollection2;
Match1: IMatch2;
match: ISubMatches;
txt
tring;
i : integer;
begin
reg := CoRegExp.Create;
reg.Global := True;
reg.IgnoreCase:=true;
reg.Pattern := '<a class="internal-link" href="http://filehippo.com.*?title="([a-z0-9\s!.]+)">[\S\s]+?<img src="(.*?.png)"/>';
http:=TIdHTTP.Create(nil);
txt:= http.Get ('http://filehippo.com/fr/software/antimalware/');
http.Request.UserAgent:='Mozilla/5.0 (Windows NT 6.1; rv:48.0) Gecko/20100101 Firefox/48.0';
MatchCollection := reg.Execute(txt) as IMatchCollection2;
if MatchCollection.Count = 0 then exit;
Match1 := MatchCollection.Item[0] as IMatch2;
match := Match1.SubMatches as ISubMatches;
begin
for match in MatchCollection do
begin
ListView1.Items.Item[i].Caption := match [0];//program names
ListView1.Items[i].SubItems.Add(match [1]);//link
inc(i)
end;
IdHTTP1.Free;
end;
end;
الخطا هو
dcc32 Error] Unit1.pas(58): E2431 for-in statement cannot operate on collection type 'IMatchCollection2' because 'IMatchCollection2' does not contain a member for 'GetEnumerator', or it is inaccessible