【发布时间】:2015-08-28 15:25:57
【问题描述】:
我想检索HTML 文档中<a> 标记中的URL。这是标签:
<a href="index.php?option=com_remository&Itemid=43&func=fileinfo&id=49"><img src="http://dziekanat.wzim.sggw.pl/components/com_remository/images/file_icons/New.gif" width="16" height="16" border="0" align="middle" alt="file_icons/New.gif"/><b> Plan STAC lato 2014_15</b></a>
解析后我应该得到
index.php?option=com_remository&amp;Itemid=43&amp;func=fileinfo&amp;id=49
我应该使用什么正则表达式模式?
我想用正则表达式来做这件事,因为 HTML 文档本身已经很老了,而且没有任何 ID 可供参考。因此,我无法使用任何更复杂的工具(如Html Agility Pack)来做到这一点。
整个文档可以在这里找到:http://dziekanat.wzim.sggw.pl/index.php?option=com_remository&Itemid=43&func=select&id=2
【问题讨论】:
-
你是如何找到这个特定的
<a>的?