我有一些文本中包含HTML超鏈接。 我想刪除超鏈接,但只有特定的鏈接。正則表達式 - 根據鏈接文本移除HTML超鏈接
例如我開始與此:
This is text <a href="link/to/somewhere">Link to Remove</a> and more text with another link <a href="/link/to/somewhere/else">Keep this link</a>
我想有:
This is text and more text with another link <a href="/link/to/somewhere/else">Keep this link</a>
我有這樣的正則表達式表達,
<a\s[^>]*>.*?</a>
...但它匹配所有的鏈接。
我需要添加到該表達式才能匹配鏈接文本中的「刪除」(例如)鏈接?
在此先感謝。
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/ 1732454#1732454 – thecoop 2010-03-22 15:24:59