/// <summary>
/// 过滤html标签
/// </summary>
/// <param name="HTML"></param>
/// <returns></returns>
public static string GetTextFromHTML(string HTML)
{
Regex regEx = new Regex(@"</?[^<]*>|\ ", RegexOptions.IgnoreCase);
return regEx.Replace(HTML, "");
}
1 string str_Content="这里获取编辑器的内容";
2 string Commfiltrchar = "过㶊字符串,以半角豆号隔开";
3 if (Commfiltrchar.IndexOf(",") > -1)
4 {
5 string[] CommfiltrcharARR = Commfiltrchar.Split(',');
6 for (int m = 0; m < CommfiltrcharARR.Length; m++)
7 {
8 str_Content = str_Content.Replace(CommfiltrcharARR[m], "***");
9 }
10 }
#region 正则替换字符串
/// <summary>
/// 正则替换字符串
/// </summary>
/// <param name="src">要修改的字符串</param>
/// <param name="pattern">要匹配的正则表达式模式</param>
/// <param name="replacement">替换字符串</param>
/// <param name="options">匹配模式</param>
/// <returns>已修改的字符串</returns>
public static string Replace (string src, string pattern, string replacement, RegexOptions options)
{
Regex regex = new Regex(pattern, options|RegexOptions.Compiled);
return regex.Replace(src, replacement);
}
#endregion