/// <요약>
/// t html 标记
/// </summary>
/// <param name = "strhtml"> 包括 html </param>
/// <Returns> 已经去除后的文字 </returns>
public static string Striphtml (String strhtml)
{
문자열 [] aryreg = {
@"<script [^>]*?>.*? </script>",
@"<(/// S*)?!? ((/w+:)?/w+) (/w+(/s*=?/s*([" ""])
@"([/r/n]) [/s]+",
@"& (quot |#34);",
@"& (amp |#38);",
@"& (lt |#60);",
@"& (gt |#62);",
@"& (nbsp |#160);",
@"& (iexcl |#161);",
@"& (Cent |#162);",
@"& (파운드 |#163);",
@"& (copy |#169);",
@"&#(/d+);",
@"->",
@"<!-.*/n"
};
문자열 [] aryrep = {
"",
"",
"",
"/" ",
"&",
"<",
">",
"",
"/xa1", // chr (161),
"/xa2", // chr (162),
"/xa3", // chr (163),
"/xa9", // chr (169),
"",
"/r/n",
"" "
};
문자열 newReg = aryreg [0];
문자열 stroutput = strhtml;
for (int i = 0; i <aryreg.length; i ++)
{
Regex Regex = New Regex (Aryreg [i], regexoptions.ignorecase);
Stroutput = regex.replace (Stroutput, aryrep [i]);
}
Stroutput.replace ( "<", "");
Stroutput.replace ( ">", "");
Stroutput.replace ( "/r/n", "");
리턴 스트라우팅;
}