【发布时间】:2013-06-15 05:35:11
【问题描述】:
我有这个正则表达式:
preg_match_all("/<a\s.*?href\s*=\s*['|\"](.*?)(?=#|\"|')/si", $data, $matches);
要查找所有网址,它可以正常工作,但是如何修改它以仅查找带有问号的网址?
例子:
<a href="http://site.com/index.php">0</a><a href="http://site.com/index.php?id=1">1</a><a href="http://site.com/calc/index.php?id=1&scheme=Venus">2</a><a href="http://site.com/catalogue/data.php">3</a>
preg_match_all 将返回:
http://site.com/index.php?id=1
http://site.com/calc/index.php?id=1&scheme=Venus
【问题讨论】:
标签: php regex html-parsing