首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

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

2012-01-18 
请问怎么用正则过滤到font标签里的除了color外的其他属性???font stylefilter: glow(color#0000FF,str

请问怎么用正则过滤到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 + ";\" >"; 

热点排行