2014-09-29 109 views
0

我使用記事本++在我的網站中執行一些正則表達式搜索。我期望找到的是空鏈接標籤。正則表達式空html鏈接

我想要什麼:

<a href="somelink.html"></a> //Match 
<a name="someanchor"></a> //Not match 
<a href="somelink.html"><img src="someimage.jpg"></a> //Not match 

我試圖用正則表達式來進行搜索: 「?」

<a(.*?)href=(.*?)\"><\/a> 

我想使得搜索非常實用,但我的搜索也挑選了img標籤。

+2

可能重複http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self- containing-tags) – 2014-09-29 20:11:30

+0

其中是正則表達式中href標籤的開頭引號? – 2014-09-29 20:14:10

+0

也是真正的它不貪婪,但它仍然希望找到一個匹配 – 2014-09-29 20:18:28

回答