using System.Text.RegularExpressions;
public static void Main()
string old_str = @"<span style=""font-weight:underline;"">John</span> <span style=""font-style: bold;"">Steve</span><span style=""text-weight:italic;"">Abrahem</span>";
string new_str1 = Regex.Replace(old_str, @"<span style=""font-weight:underline;"">(.*?)</span>", new MatchEvaluator(ReplaceUnderline));
string new_str2 = Regex.Replace(new_str1, @"<span style=""font-style: bold;"">(.*?)</span>", new MatchEvaluator(ReplaceBold));
string new_str3 = Regex.Replace(new_str2, @"<span style=""text-weight:italic;"">(.*?)</span>", new MatchEvaluator(ReplaceItalic));
Console.WriteLine(new_str3);
static string ReplaceUnderline(Match m)
return "<ul>" + m.Groups[1] + "</ul>";
static string ReplaceBold(Match m)
return "<b>" + m.Groups[1] + "</b>";
static string ReplaceItalic(Match m)
return "<i>" + m.Groups[1] + "</i>";