procedure TForm1.Button14Click(Sender: TObject);
var
machs: IMatchCollection;
Matchs: Match;
submatch: ISubMatches;
i: integer;
url,url1:string;
begin
url:='http://www.cnblogs.com/del/archive/2007/12/21/1009482.html';
str :=idhttp1.get(url);
RegExp1.Global := true;
RegExp1.Pattern :='<img src=\"(.+?)\"';
RegExp1.IgnoreCase := true;
machs := RegExp1.Execute(str) as IMatchCollection;
for i := 0 to machs.Count - 1 do
begin
Matchs := machs.Item[i] as Match;
submatch := Matchs.SubMatches as ISubMatches;
memo4.Lines.Add(matchs.Value);
end;
end;
URL随便写个网址就能匹配到源代码中的图片地址,但是写本地的HTML文件(file:///D:/6.21/6.21/index.htm)就是不行,提示错误 EIDUnknownProtocol with message '' 是不是地址的问题呀 但那个// 能组合的我几乎换遍了 就是不行 求教啊
var
machs: IMatchCollection;
Matchs: Match;
submatch: ISubMatches;
i: integer;
url,url1:string;
begin
url:='http://www.cnblogs.com/del/archive/2007/12/21/1009482.html';
str :=idhttp1.get(url);
RegExp1.Global := true;
RegExp1.Pattern :='<img src=\"(.+?)\"';
RegExp1.IgnoreCase := true;
machs := RegExp1.Execute(str) as IMatchCollection;
for i := 0 to machs.Count - 1 do
begin
Matchs := machs.Item[i] as Match;
submatch := Matchs.SubMatches as ISubMatches;
memo4.Lines.Add(matchs.Value);
end;
end;
URL随便写个网址就能匹配到源代码中的图片地址,但是写本地的HTML文件(file:///D:/6.21/6.21/index.htm)就是不行,提示错误 EIDUnknownProtocol with message '' 是不是地址的问题呀 但那个// 能组合的我几乎换遍了 就是不行 求教啊
file这是啥协议呢?
本地的话自己架设一个HTTP通过
idhttp1.get('http://127.0.0.1/index.htm');
这样就可以了