preg_match_all():编译失败:没有什么可以在偏移203 runescape重复

时间:2012-08-22 11:38:31

标签: php preg-match preg-match-all

有人可以告诉我为什么这不起作用吗?

我收到错误“preg_match_all():编译失败:没有什么可以在203处重复”

$html = file_get_contents('http://services.runescape.com/m=itemdb_rs/results.ws?query='.urlencode($term).'&price='.$pricerange.'&members='.$members);
$html = str_replace(array("\r","\n"), "", $html);
$regexp = '#<tr data-item-id="(.*?)"><td class="(.*?)"><img src="(.*?)" alt="(.*?)"><a href="(.*?)">(.*?)</a></td><td><img src="(.*?)" alt="(.*?)" title="(.*?)"></td><td class="(.*?)">(.*?)</td><td class="(.*?)">(.?*)</td></tr>#';
preg_match_all($regexp, $html, $matches);
print_r($matches);

将在file_get_contents中使用的示例url

http://services.runescape.com/m=itemdb_rs/results.ws?query=gold%20bar&price=all&members=no

谢谢:)

1 个答案:

答案 0 :(得分:1)

我建议您的错误就在这里:

<td class="(.*?)">(.?*)</td></tr>#

替换为

<td class="(.*?)">(.*?)</td></tr>#