我正在嘗試從源代碼中提取URL。源代碼是類似於以下正則表達式:提取包含文本的URL
text text text<h4 class="a"><a href="http://site1.com/url/" onmousedown="return rwt(this,'','','','15',111','','0333','','',home)">...</a></h4>
我達到迄今(?<=<h4\ class="a"><a\ href=")http://.*
,但這仍然不是僅提取URL。我需要輸出僅爲http://site1.com/url/
。
在此先感謝!
使用dom或xml解析器而不是正則表達式來解析html – baao