求个正则表达式 
要求不能在以下字符之中
^`{}|~`'()<>&--;:%_*?+/=\t\r\n利用!Regex.IsMatch(input,pattern)来匹配的时候
这个正则表达式应该怎么写?搞了一天只能搞到 string pattern = @"\^|`|\{|}|\||~|'";
这么多字符 后面的搞不定 求大侠帮忙

解决方案 »

  1.   

    [^\^\`\{\}\|\~\`\'\(\)\<\>\&\-\;\:\%\_\*\?\+\/\=\\\t\\\r\\\n]
      
    -----------------------------------------------
    msn:[email protected]
    请给我一个与您交流的机会
      

  2.   

    ^[^^`{}|~`'()<>&--;:%_*?+/=\t\r\n]*$
      

  3.   

    楼上这样写程序中出现解析exception
      

  4.   

    2楼这样写程序中出现解析exception
      

  5.   

    我这里测试没问题啊
    Regex re = new Regex(@"^[^^`{}|~`'()<>&--;:%_*?+/=\t\r\n]*$", RegexOptions.None);
    MatchCollection mc = re.Matches("text");
    foreach (Match ma in mc)
    {
    }
      

  6.   

    trystring yourStr = ...........;
    if (!Regex.IsMatch(yourStr, "[\\^`{}|~`'()<>&--;:%_*?+/=\t\r\n]"))
    {
        richTextBox2.Text = "符合";
    }
    else
    {
        richTextBox2.Text = "不符合";
    }