过滤脏话


using System.Text.RegularExpressions;
if(strContent.Trim() != "")
   {
    string[] unlegal2=new string[5]{"脏话。。。"} ;
    
    for (int i = 0;i<unlegal2.Length ;i++)
    {
     Regex content_1 =new Regex(unlegal2[i]);
     Match content_all = content_1.Match(strContent);
     if (content_all.Success)
     {
      this.Response.Write("<script>alert('您的发贴内容中含有不文明言词,请更新,谢谢合作!');</script>");
      return ;
     }
    }
   }

posted @ 2006-02-21 17:10  Ame  阅读(683)  评论(2编辑  收藏  举报