String fileName="asadas.jsp"; String reg = ".+(.JPEG|.jpeg|.JPG|.jpg|.png|.PNG)$"; Matcher matcher =Pattern.compile(reg).matcher(fileName); System.out.println(matcher.find());
public String[] simpleFile (String file){ int sum = file.lastIndexOf("."); return new String[]{ file.substring(0, sum), file.substring(sum + 1) }; }