Public static string nohtml (string htmlstring)
{
// Delete the script
Htmlstring = RegEx. Replace (htmlstring, @ "<SCRIPT [^>] *?>. *? </SCRIPT> ","",
Regexoptions. ignorecase );
// Delete HTML
Htmlstring = RegEx. Replace (htmlstring, @ "<(. [^>] *)> ","",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "([\ r \ n]) [\ s] + ","",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "-->", "", regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "<! --. * "," ", Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (quot | #34 );","\"",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (Amp | #38 );","&",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (LT | #60);", "<",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (GT | #62);", "> ",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (nbsp | #160 );","",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (iexcl | #161);", "\ xA1 ",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (cent | #162);", "\ xa2 ",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (pound | #163);", "\ xa3 ",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& (copy | #169);", "\ xa9 ",
Regexoptions. ignorecase );
Htmlstring = RegEx. Replace (htmlstring, @ "& # (\ D + );","",
Regexoptions. ignorecase );
Htmlstring = htmlstring. Replace ("<","");
Htmlstring = htmlstring. Replace ("> ","");
Htmlstring = htmlstring. Replace ("\ r \ n ","");
// Htmlstring = httpcontext. Current. server. htmlencode (htmlstring). Trim ();
Return htmlstring;
}