private boolean isMatch(String path, String pattern) {
        int index = 0;
        String[] matches = pattern.split("\\*");
        for (String match : matches) {
            if ("".equals(match)) {
                continue;
            }
            int nextIndex = path.lastIndexOf(match);
            if (nextIndex != -1 && nextIndex >= index) {
                index = nextIndex;
            } else {
                return false;
            }
        }
        return true;
    }