[^abc]表示不包含a、b、c中任意字符, 我想实现不包含字符串abc应该如何写表达式?
从网上找的,简洁的写法:\b((?!abc)\w)+\b
如:
从html标记中取出文字内容和图片
using System.Text.RegularExpressions;
--------------------------------------
string ohtml = "afdsfasd<span>span2</span><m><p>asdf</p>sdfsd</m><i>kkk</i><b>bbbb</b><input class=\"del\" onclick='Del(\"m1\")' value=\"X\" type=\"button\"> <img src=><span>span</span>";
Response.Write(Regex.Replace(ohtml, @"<(\b((?!img)\w)+\b|/).*?(>|/>)", ""));
--------------------------------------