0

我有一段看起来像这样:

First.Check out this <a href="https://sample.com/applications/Documents/SolutionContingency.html" target="_blank">demo </a>to learn about the Solution Contingency feature of MME.  

Second Paragraph. Get your head out of the fog and use the solution contingency feature in MME! All the costs for a WMU are displayed on the Costs screen in the Forecast menu. 

<a href="https://blog.sample.com/mme/files/2013/07/SC2.jpg"><img title="SC2" alt="" src="https://blog.sample.com/mme/files/2013/07/SC2.jpg" width="1262" height="711" /></a>

Fourth.You should review your solution contingency at least once a month.    

我刚刚使用正则表达式将图像网址替换为空字符串,使用以下方法:

(<a.*?<img.*?>.*?/a>|<img.*?>)

您知道为什么从超链接到图片的输出被切断了吗?它只显示第一和第四段。

这是输出:

First.Check out this Fourth.You should review your solution contingency at least once a month.    

当段落没有超链接时,删除图片效果很好。

4

1 回答 1

0

我不是 100% 确定你在追求什么。如果您只想隔离图像标签,可以将您的正则表达式更改为以下内容:(<img.*?>)

于 2013-08-13T09:13:31.683 回答