本文整理自网络,侵删。
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses System.SysUtils, System.Classes, System.Net.HttpClient, System.RegularExpressions;
const url = 'http://www.delphitop.com/';varmatchs: TMatchCollection;m: TMatch;begin var http := THttpClient.Create; var sl := TStringList.Create;
try sl.LoadFromStream(http.Get(url).ContentStream, TEncoding.ANSI);
matchs := TRegEx.Matches(sl.Text, '<span>(?<price>(\d+[,.])*\d+)</span>');for m in matchs dobeginwriteln('获取信息: ', m.Groups.Item['price'].Value);end;
Readln; finally sl.Free; http.Free; end;end.
相关阅读 >>
Delphi 2009 泛型容器单元(generics.collections)[3]: tstack<t>
Delphi yesterday、today、tomorrow - 昨天、今天、明天
Delphi的unicode与gb2312转转换,汉字unicode转gb2312
Delphi winsoft comport for android usb
Delphi webbrowser同时访问两个网址导致程序出错的解决办法
更多相关阅读请进入《Delphi》频道 >>