不匹配一个单词

string[] slist =   { "shit", "no", "SHIT", "xxsHitxx" };
Regex re = new Regex(@"^(?!.*(?i:shit))");
foreach (string s in slist)
     Console.WriteLine("{0}   matches?   {1}", s, re.IsMatch(s));
posted @ 2007-08-16 17:03 lywf 阅读(44) 评论(0) 编辑 收藏