2 效验代码
String fileName="<>?.xml"; boolean isPass = fileName.matches("[^\\s\\\\/:\\*\\?\\\"<>\\|](\\x20|[^\\s\\\\/:\\*\\?\\\"<>\\|])*[^\\s\\\\/:\\*\\?\\\"<>\\|\\.]$"); System.out.println(isPass); //结果: false