public static String convertNamePatternList(String patternList, String fieldName, boolean includeUnnamed) {
        String[] patterns = patternList.split(",");
        StringBuilder combinedPattern = new StringBuilder("(");
        boolean compound = false;

        for(String pattern : patterns) {
            pattern = pattern.trim();
            String[] namedFieldPattern = pattern.split("=", 2);
            if(namedFieldPattern.length == 2) {
                if(!namedFieldPattern[0].trim().equals(fieldName)) {
                    continue;
                }
                pattern = namedFieldPattern[1].trim();
            } else if(fieldName != null && !includeUnnamed) {
                continue;
            }

            if(pattern.length() > 0) {
                String converted = convertNamePattern(pattern);

                if(converted.length() == 0) {
                    continue;
                }

                try {
                    Pattern.compile(converted);
                } catch(PatternSyntaxException e) {
                    throw new IllegalArgumentException("Unable to convert pattern " + pattern + " to regular expression. " + e.getMessage(), e);
                }

                if(combinedPattern.length() > 1) {
                    compound = true;
                    combinedPattern.append('|');
                }

                combinedPattern.append(converted);
            }
        }

        if(compound) {
            combinedPattern.append(')');
        } else {
            combinedPattern.deleteCharAt(0);
        }

        return combinedPattern.length() == 0 ? null : combinedPattern.toString();
    }
Take a string that represents a list of patterns, possibly a mixture of
regular expressions and Ant-style patterns, and return a single regular
expression that matches any of the alternatives.

To allow users to target some parts of the filter list to some fields on
the object to which the pattern is ultimately applied, it is possible to
prefix patterns in the list with fieldName=pattern, and then the pattern
can be excluded from use on unrelated fields.

@param patternList the pattern list specification to convert
@param fieldName the field name for which patterns should be selected
@param includeUnnamed if true, include patterns that do not specify a
                      field name

@return the combined pattern, or null if there is are no patterns for
the field.

@throws PatternSyntaxException if any of the individual patterns fails
to compile as a regular expression.
src/main/java/io/fabric8/maven/docker/util/NamePatternUtil.java