If Regex.IsMatch(theCode, ("[\t\r\n\*\?\+\|\\<>""'&:,;]")) = True Then 'these is reserved char, forbid file name and html reserved char. "," is code list delimiter, ":" is code sign delimiter
tmpResult = False
End If
If Regex.IsMatch(theCode, ("[^ a-zA-Z0-9_\.\-\/]")) = True Then 'the code only allow letter and number char, allow "/", if the code use to fiel name, will replace "/" to "_"

解决方案 »

  1.   

    第一个:匹配 \t \r \n * ? + | \ < > " ' & : , ; 这些中的任意一个字符,
    []是字符集 表示里面字符中的任意一个第二个:匹配除 a-z A-Z 0-9 _ . - / 之外的任意字符 [^] 是字符集取反 表示非里面包括的字符
      

  2.   

    这个是验证数据库"_code"字段输入内容的合法性的。
    也就是说,第二个正则表达式是除了字母数字、下划线连字符、小数点反斜杠之外的其他字符是吧。第一个 像这个   \t\r\n  "\n"换行符,\r  \t  我不知道什么意思。code字段,肯定不允许回车空格换行的
    :,应该也不允许有的吧。
      

  3.   

    \t 横向制表符 有空格
    \r 换行
    \n 回车
    其实 正则中 \s 就包括这些空白字符了