我有一段内容如下:
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.
我刚刚用regex替换了图像url,用空字符串替换:
(<a.*?<img.*?>.*?/a>|<img.*?>)
你知道为什么从超链接到图片的输出被切断了吗。它只显示第一段和第四段。
这是输出:
First.Check out this Fourth.You should review your solution contingency at least once a month.
当段落没有超链接时,删除图片效果很好。。
我不能100%确定你在追求什么。如果您只想隔离图像标记,您可以将正则表达式更改为以下内容:(<img.*?>)