Skip to content

Instantly share code, notes, and snippets.

@guoxiangke
Created November 9, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guoxiangke/f0be0016b1daada3aaf9 to your computer and use it in GitHub Desktop.
Save guoxiangke/f0be0016b1daada3aaf9 to your computer and use it in GitHub Desktop.
匹配到最后一个括号里的内容 preg (
[\((][\s\S]*[\))]
@guoxiangke
Copy link
Author

/style="(.*?)"/ 去除style="" of html element

//string regexstr = @"<[^>]>"; //去除所有的标签
//@"<script[^>]
?>.*?</script>" //去除所有脚本,中间部分也删除

    // string regexstr = @"<img[^>]*>";   //去除图片的正则
   // string regexstr = @"<(?!br).*?>";   //去除所有标签,只剩br
    // string regexstr = @"<table[^>]*?>.*?</table>";   //去除table里面的所有内容
    string regexstr = @"<(?!img|br|p|/p).*?>";   //去除所有标签,只剩img,br,p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment