code: public static Pattern createFilePattern(String filePattern) {
        filePattern = StringUtils.isNullOrBlank(filePattern) ? "\\*" : filePattern;
        filePattern = filePattern.replaceAll("\\.", "\\.");
        filePattern = filePattern.replaceAll("\\*", ".*");
        return Pattern.compile("^" + filePattern + "$");
     }
docs: Create file pattern pattern.
  
  @param filePattern the file pattern
  @return the pattern