Currently facing a challenging situation where I have a C# string with html tags:
string strHTML = "
<span style="font-size: 10px;">Hi This is just a section of html text.</span><span style="font-family: 'Verdana'; font-size: 10px;">Please help</span><span>me add style attributes to span tags.Thank You</span>
";
The issue lies in the fact that two span tags are missing the "font-family: 'Verdana';" attribute. I need a solution that can automatically add this attribute to those specific span tags. The end result should resemble something like this:
"
<span style="font-size: 10px;font-family: 'Verdana';">Hi This is just an example of html text.</span><span style="font-family: 'Verdana'; font-size: 10px;">Please help<span style="font-family: 'Verdana';">me add style attributes to span tags.Thank You</span>
"
I'm aware that one quick fix could be to manually insert another span tag at the beginning of the string, but I'd prefer to avoid that approach. Any assistance on resolving this matter would be greatly appreciated.
Update: I've attempted to use the Regex.Replace method extensively without success in achieving the desired output.