private static boolean segmentMatches(String value, String segmentPattern) {
        String regex = segmentPattern
                .replace(".", "\\.").replace("*", ".*").replace(":", "\\:")
                .replace('?', '.').replace("(", "\\(").replace(")", "\\)")
                .replace("[", "\\[").replace("]", "\\]");
        return Pattern.matches(regex, value);
    }
Matches simple glob like patterns using '?' and '*'
vespa-enforcer-extensions/src/main/java/com/yahoo/vespa/maven/plugin/enforcer/EnforceDependencies.java