/// <Summary>
/// Remove HTML tags
/// </Summary>
/// <Param name = "strhtml"> including the source code of HTML </param>
/// <Returns> removed text </returns>
Public static string striphtml (string strhtml)
{
String [] aryreg = {
@ "<SCRIPT [^>] *?>. *? </SCRIPT> ",
@ "<(\/\ S *)?!? (\ W + :)? \ W +) (\ W + (\ s * =? \ S * (["" ']) (\ ["" 'tbnr] | [^ \ 7]) *? \ 7 | \ W +) |. {0}) | \ s )*? (\/\ S *)?> ",
@ "([\ R \ n]) [\ s] + ",
@ "& (Quot | #34 );",
@ "& (Amp | #38 );",
@ "& (LT | #60 );",
@ "& (GT | #62 );",
@ "& (Nbsp | #160 );",
@ "& (Iexcl | #161 );",
@ "& (Cent | #162 );",
@ "& (Pound | #163 );",
@ "& (Copy | #169 );",
@ "(\ D + );",
@ "--> ",
@ "<! --. * \ N"
};
String [] aryrep = {
"",
"",
"",
"\"",
"&",
"<",
"> ",
"",
"\ XA1", // CHR (161 ),
"\ Xa2", // CHR (162 ),
"\ Xa3", // CHR (163 ),
"\ Xa9", // CHR (169 ),
"",
"\ R \ n ",
""
};
String newreg = aryreg [0];
String stroutput = strhtml;
For (INT I = 0; I <aryreg. length; I ++)
{
RegEx = new RegEx (aryreg [I], regexoptions. ignorecase );
Stroutput = RegEx. Replace (stroutput, aryrep [I]);
}
Stroutput. Replace ("<","");
Stroutput. Replace ("> ","");
Stroutput. Replace ("\ r \ n ","");
Return stroutput;
}