What would be the C# / regex syntax to remove the link from the first image in a body of text like:
text
<a href="..." class="..."><img src="..." class="..." width="..." /></a>
more text
<a href="..." class="..."><img src="..." class="..." width="..." /></a>
even more text
So that the final result would be:
text
<img src="..." class="..." width="..." />
more text
<a href="..." class="..."><img src="..." class="..." width="..." /></a>
even more text
Any advice would be greatly appreciated! Thanks in advance.
Using the HTML Agility Pack (project page, nuget), this does the trick:
I personally find this a lot easier on the eyes, as it clearly states what you are trying to accomplish.