移除字符串中的html标记及属性

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            string s = ds.Tables[0].Rows[i]["context"].ToString();
            s = Regex.Replace(Convert.ToString(ds.Tables[0].Rows[i]["context"]), @"(?!<br/>)<[\s\S]*?>", "", RegexOptions.IgnoreCase);
            s = s.Replace("&nbsp;", "");
            //s= RemoveHtml(s);
            s = s.Replace(',', '#');
            s = s.Replace('。', '*');
            s = s.Replace('’', '@');
            s = s.Replace('“', '&');
            s = s.Replace('”', '^');
            ds.Tables[0].Rows[i]["context"] = s;
           

        }

posted @ 2008-07-14 17:13  俊哥哥  阅读(192)  评论(0编辑  收藏  举报