【发布时间】:2010-04-23 15:31:13
【问题描述】:
我有一些包含 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>
...但它匹配所有链接。
我需要在该表达式中添加什么内容才能仅匹配带有链接文本“删除”(例如)的链接?
提前致谢。
【问题讨论】: