String fileName = "zhauyxsnxu|/|.xls";
Pattern pattern = Pattern.compile("[\\s\\\/:\*\?\\"<>\|]");
Matcher matcher = pattern.matcher(fileName);
fileName= matcher.replaceAll(""); // 将匹配到的非法字符以空替换
System.out.println(fileName);
https://www.cnblogs.com/hyiam/p/5736017.html
标签:Pattern,校验文件,fileName,修改,matcher,pattern,合法 From: https://www.cnblogs.com/xx2017/p/16850423.html