试试这个正则表达式(1[0-2]|0?[1-9])[-./](0?[1-9]|[12][0-9]|3[01])[-./](\d\d\d\d))  
如果实在不行就一个一个字符去判断.就6个字符,话不了多少时间的

解决方案 »

  1.   


     如下: private void button1_Click(object sender, System.EventArgs e)
    {
             bool yn=Regex.IsMatch(tex.Text,"^[1,2][0-9]{3}(?([0])0[1-9]|1[0-2])(?([0-2])(?([0])0[1-9]|[1,2][0-9])|[30,31])$");
    if(yn==true) 
    {
          MessageBox.Show("YES");//符合"20030601"的日期格式
    }
    else
    {
          MessageBox.Show("NO");//不符合"20030601"的日期格式 }

    } 试试这个,我没有仔细测. :)