Assuming you never had any attributes after the style, I would put something like
class Program
{
const string SOURCE = @"<BR style=color:#93c47d>
<BR style=color:#fefefe>
<BR style=""color:#93c47d"">
<BR style='color:#93c47d'>
<BR>
<BR/>
<br style=color:#93c47d>
<br style=color:#fefefe>
<br style=""color:#93c47d"">
<br style='color:#93c47d'>
<br>
<br/>";
static void Main(string[] args)
{
const string EXPRESSION = @"(style=[^""'][^>]*)|(style=""[^""]*"")|(style='[^']*')";
var regex = new Regex(EXPRESSION);
Console.WriteLine(regex.Replace(SOURCE, string.Empty));
}
}
You might be better off with a software solution if there are attributes written to the tag after the style attribute.
MaxGuernseyIII
source
share