How to clean HTML fromany special tag via Regex in C#?
Here is a sample HTML where Ineed to delete <font size="-2">
R&usg=AFQjCNFYiDC6u3xOGn4JpO-GF83PjdSbtw&url=http://online.wsj.com/article/SB10000872396390444426404577647060576633348.html"><img src="//nt2.ggpht.com/news/tbn/bm6jvTMtF-PpnM/6.jpg" alt="" border="1" width="80" height="80" /><br /><font size="-2">Wall Street Journal</font></a></font>
</td>
I know we have to use somehow Regex, but I cannot figure out how we can use it.
I have tried to adjust this method but it cleans ALL tags.
public string Strip(string text)
{
return Regex.Replace(text, @”<(.|\n)*?>”, string.Empty);
}
In fact I am looking to some approach to do like this
public string Strip(string text, HTMLTags.Font)
{
}
where HTMLTags.Font is a enum of some of the HTML tags
enum HTMLTags
{
Font,
Div,
Td
...
}
Thank you for any clue!!!
use HtmlAgilityPack to parse html