I want to remove inner style from html by using c#. Here is my Html text
<span style="font-family: tahoma; color: #9bbb59;">This is a simple text.</span><br />
<table>
<thead>
</thead>
<tbody>
<tr>
<td> R1C1</td>
<td>R1C2</td>
</tr>
<tr>
<td>R2C1</td>
<td>R2C2</td>
</tr>
</tbody>
</table>
<style type="text/css" id="telerik-reTable-1">
.telerik-reTable-1 {
border-width: 0px;
border-style: none;
border-collapse: collapse;
font-family: Tahoma;
}
.telerik-reTable-1 td.telerik-reTableFooterEvenCol-1 {
padding: 0in 5.4pt 0in 5.4pt;
text-align: left;
border-top: solid gray 1.0pt;
}
</style>
I want it to looks like after remove inner css.
<span style="font-family: tahoma; color: #9bbb59;">This is a simple text.</span><br />
<table>
<thead>
</thead>
<tbody>
<tr>
<td> R1C1</td>
<td>R1C2</td>
</tr>
<tr>
<td>R2C1</td>
<td>R2C2</td>
</tr>
</tbody>
</table>
I used this pattern @"<\s*style[^(style>)]*style>"
. But it's not working.
Note: I think I cann't use HtmlDocument to remove child node. Because it does not maintain parent child node relationship. so I want to use regular expression to remove the CSS.