【发布时间】:2014-01-26 20:19:30
【问题描述】:
我正在尝试构建一个FaH 统计数据刮板。每小时都会通过cron 和wget 将新更新的统计信息列表拉到我的服务器上,并放入这个文件http://chrislabs.info/statsFile.txt。这是在脚本中以$page 使用file_get_contents 打开的。
然后,对于唯一团队编号列表(第四列),我尝试使用以下代码对包含该团队编号的所有行进行正则表达式:
foreach($teamArr as $team){
$pattern = "/(.*[ascii])\t([0-9]*)\t.*[0-9]\t$team/";
preg_match_all($pattern, $page, $matches);
echo "<pre>";
print_r($matches);
echo "</pre>";
但是,这并没有在 $page 中找到所有匹配项,我现在不知道要修复什么。我已将 pcre.* INI 设置更改为最高 1GB。
【问题讨论】:
标签: php regex preg-match-all