Public static string delhtml (string htmlstring) // remove html
{
# Region
// Delete the script
Htmlstring = system. Text. regularexpressions. RegEx. Replace (htmlstring, @ "<SCRIPT [^>] *?>. *? </SCRIPT> "," ", system. Text. regularexpressions. regexoptions. ignorecase );
// Delete HTML
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "<(. [^>] *)> "," ", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "([\ r \ n]) [\ s] +", "", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. Text. regularexpressions. RegEx. Replace (htmlstring, @ "-->", "", system. Text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. Text. regularexpressions. RegEx. Replace (htmlstring, @ "<! --. * "," ", System. Text. regularexpressions. regexoptions. ignorecase );
// Htmlstring = system. Text. regularexpressions. RegEx. Replace (htmlstring, @ "<A>. * </a> ","");
// Htmlstring = system. Text. regularexpressions. RegEx. Replace (htmlstring, @ "<[A-Za-Z] * = \. [A-Za-Z] * \? [A-Za-Z] + = \ D & \ W = % [A-Za-Z] * | [A-Z0-9] "," ");
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (quot | #34);", "\" ", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (Amp | #38);", "&", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (LT | #60);", "<", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (GT | #62);", ">", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. Text. regularexpressions. RegEx. Replace (htmlstring, @ "& (nbsp | #160);", "", system. Text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (iexcl | #161);", "\ xA1", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (cent |# 162);", "\ xa2", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (pound | #163);", "\ xa3", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. text. regularexpressions. regEx. replace (htmlstring, @ "& (copy | #169);", "\ xa9", system. text. regularexpressions. regexoptions. ignorecase );
Htmlstring = system. Text. regularexpressions. RegEx. Replace (htmlstring, @ "& # (\ D +);", "", system. Text. regularexpressions. regexoptions. ignorecase );
Htmlstring. Replace ("<","");
Htmlstring. Replace ("> ","");
Htmlstring. Replace ("\ r \ n ","");
// Htmlstring = httpcontext. Current. server. htmlencode (htmlstring). Trim ();
# Endregion
Return htmlstring;
}