String input = "D:\\save\\任意文件名.pdf";String regex = ".*\\\\([^\\.]+)\\..*";input.replaceAll(regex, "$1");