<style type="text/css">
* {margin: 0;padding: 0;}
body{background-color:transparent;}
body {font: 90%/normal Arial, Helvetica, sans-serif;}
a:link {color: #00c;text-decoration: underline;}
a:visited {color: #800080;}
strong {color: #c03;font-weight: normal;}
</style>
主要是想要过滤掉这些代码,但是不知道怎么匹配,求助试过HTML的过滤代码,但是 中间的字母字符过滤不了,
* {margin: 0;padding: 0;}
body{background-color:transparent;}
body {font: 90%/normal Arial, Helvetica, sans-serif;}
a:link {color: #00c;text-decoration: underline;}
a:visited {color: #800080;}
strong {color: #c03;font-weight: normal;}
</style>
主要是想要过滤掉这些代码,但是不知道怎么匹配,求助试过HTML的过滤代码,但是 中间的字母字符过滤不了,
解决方案 »
- treeview
- System.Date.Now.AddMilliseconds(interval)怎样理解这里的Interval
- 用C#的webbrower如何控制网页中的CSS
- 谁提供点关于BHO的资料啊或者教程啊
- TaskVision调用WebService的GetUserInfo出错
- C#中相当于C++当中map<>的功能的容器是什么?
- 怎么编个网页,自动页面换大小
- 简单的实际问题~~请求帮忙~~~C#加密 app.config 最后60分 全部放出
- B窗体的事件中更改A窗体中控件的属性,我这样做有什么不对?(winform)
- C# winform程序 莫名的错误??求救!!
- 关于引用类型的转换
- ---求思路,c#怎么写一个自定义控件,能在vb中调用?
string result = Regex.Replace(html,@"(?is)<style[^>]*>.*?</style>","");
public static string RemoveStyle(string HtmlCode)
{
string MatchVale = HtmlCode;
foreach (Match s in Regex.Matches(HtmlCode, "<style[^>]*>.*?</style>"))
{
MatchVale = MatchVale.Replace(s.Value, "");
} foreach (Match s in Regex.Matches(HtmlCode, "</style>"))
{
MatchVale = MatchVale.Replace(s.Value, "");
} return MatchVale;
}
public static string RemoveStyle(string HtmlCode)
{
string MatchVale = HtmlCode;
foreach (Match s in Regex.Matches(HtmlCode, "<style[^>]*>.*?</style>"))
{
MatchVale = MatchVale.Replace(s.Value, "");
} foreach (Match s in Regex.Matches(HtmlCode, "</style>"))
{
MatchVale = MatchVale.Replace(s.Value, "");
} return MatchVale;
}
是这样使用吗??
Console.Write(Regex.Replace(str, @"(?is)<style[^>]*>(.*?)</style>", ""));