当前位置: 代码迷 >> J2EE >> 请教如何用正则过滤到font标签里的除了color外的其他属性?
  详细解决方案

请教如何用正则过滤到font标签里的除了color外的其他属性?

热度:198   发布时间:2016-04-22 03:15:55.0
请问怎么用正则过滤到font标签里的除了color外的其他属性???
<font style="filter: glow(color=#0000FF,strength=3);color:#FFFFFF;display:inline-block;" >
比如这个标签里,只想保留
<font style="color:#FFFFFF;" >
谢谢了。。。

------解决方案--------------------
C# code
   string subjectString = "<font style=\"filter: glow(color=#0000FF,strength=3);color:#FFFFFF;display:inline-block;\" > ";            string regex1 = "<.+=\"";            string regex2 = @"color:[^;]+";            string result1 = Regex.Match(subjectString, regex1).Value;            string result2 = Regex.Match(subjectString, regex2).Value;            string result = result1 + result2 + ";\" >";
  相关解决方案