posts - 22, comments - 25, trackbacks - 0, articles - 3
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

公告

用正则表达式移除字符串中的HTML标记

Posted on 2007-01-04 13:46 Don 阅读(89) 评论(0) 编辑 收藏
  public static string RemoveHTML(string strHtml)
  {
   
string strOutput=strHtml;
   Regex regex 
= new Regex(@"<[^>]+>|</[^>]+>");
   strOutput 
= regex.Replace(strOutput,"");
   
return strOutput;
  }