Remove Unused (Empty) HTML Tags

c# html-agility-pack regex replace

Question

I'm looking way to clear/remove all HTML tags they have nothing...

For example:

<p></p><div> to make links</div><b> </b>
<a href="http://foo.com"></a><p> for linebreak add 2 spaces at end
</p><strong></strong><i></i>

To:

<div> to make links</div><p> for linebreak add 2 spaces at end</p>

//I'm sure it is not dublicate.

1
0
10/6/2014 11:13:11 PM

Popular Answer

<[^>]*>\s*<\/[^>]*>

Try this.This will remove empty tags.See demo.

http://regex101.com/r/hQ1rP0/26

0
10/7/2014 4:15:46 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow