C# 正则表达式用html文件中任意位置的th标记替换tr标记

C# 正则表达式用html文件中任意位置的th标记替换tr标记,c#,regex,winforms,C#,Regex,Winforms,在HTML文件中的任何位置,用表的标记的th标记替换tr标记的正则表达式应该是什么?regex.Replace(HTML,@)(?+1.请告诉我。您还需要替换结束标记:regex.Replace(strHTML,@“),”@Diadistis,它是否会替换html文件中tr标记中的所有th标记,无论是否有属性或任何东西?新建Regex(“()”,RegexOptions.IgnoreCase | RegexOptions.MultipleLine)。替换(html,m=>m.Group[1]。V

在HTML文件中的任何位置,用
表的
标记的
th
标记替换
tr
标记的正则表达式应该是什么?

regex.Replace(HTML,@)(?+1.请告诉我。您还需要替换结束标记:regex.Replace(strHTML,@“),”@Diadistis,它是否会替换html文件中
tr
标记中的所有
th
标记,无论是否有属性或任何东西?新建Regex(“()”,RegexOptions.IgnoreCase | RegexOptions.MultipleLine)。替换(html,m=>m.Group[1]。Value+“tr”+m.Group[3]。Value);未测试…@Diadistis,抱歉我的错误,但我想替换
tr
标记,而不是
th
标记。@Harikrishna:只需交换它们:Regex.replace(html,@)(?
Regex.Replace(html, @"(?<=<(/)?)th(?=[\s>])", "tr", RegexOptions.IgnoreCase);