1 Pattern pattern = Pattern.compile("[\\s\\\\/:\\*\\?\\\"<>\\|]"); 2 Matcher matcher = pattern.matcher(fileName); 3 formatFileName= matcher.replaceAll("");
1 fileName.matches("[^\\s\\\\/:\\*\\?\\\"<>\\|](\\x20|[^\\s\\\\/:\\*\\?\\\"<>\\|])*[^\\s\\\\/:\\*\\?\\\"<>\\|\\.]$");
原文:https://www.cnblogs.com/d191/p/12081252.html