bw-maven-plugin/src/main/java/fr/fastconnect/factory/tibco/bw/maven/packaging/MergePropertiesMojo.java
protected Properties expandWildCards(Properties properties) {
    	Properties propertiesWithWildCards = new Properties() { // sorted properties
			private static final long serialVersionUID = 7793482336210629858L;

			@Override
		    public synchronized Enumeration<Object> keys() {
		        return Collections.enumeration(new TreeSet<Object>(super.keySet()));
		    }
		};
    	String key;
    	
    	// retrieve the keys with WildCards
		Enumeration<Object> e = properties.keys();
   		while (e.hasMoreElements()) {
    		key = (String) e.nextElement();
    		if (isAWildCard(key)) {
    			propertiesWithWildCards.setProperty(key, properties.getProperty(key));
    			properties.remove(key);
    		}
    	}
    	
    	// try to replace the values of other keys matching the keys with WildCards
		Enumeration<Object> w = propertiesWithWildCards.keys();
   		while (w.hasMoreElements()) {
    		String keyWithWildCards = (String) w.nextElement();
    		String regex = wildcardToRegex(keyWithWildCards);

			String ignoreWildcardInVariablesPattern = "(.*)variables\\\\\\[(.*)\\\\\\]\\/variable\\\\\\[(.*)\\\\\\](.*)";
			Pattern p = Pattern.compile(ignoreWildcardInVariablesPattern);
			Matcher m = p.matcher(regex);
			if (m.matches()) {
				String variables = m.group(2);
				String variable = m.group(3);
				variables = variables.replace(".*", "\\*");
				variable = variable.replace(".*", "\\*");
				regex = m.group(1) + "variables\\[" + variables + "\\]/variable\\[" + variable + "\\]" + m.group(4);
			}

    		Boolean found = false;

    		e = properties.keys();
    	   	while (e.hasMoreElements()) {
    			key = (String) e.nextElement();
    			
    			if (Pattern.matches(regex, key)) {
    				found = true;
    				String value = (String) propertiesWithWildCards.getProperty(keyWithWildCards);
    				properties.setProperty(key, value);
    			}
    		}

    	   	// not found, we put back the expression with wild cards in the original list (false positive)
    	   	// this way the wildcard can still be used in a next pass and will be removed at the end by AbstractPackagingMojo.removeWildCards 
    		if (!found) {
    			properties.setProperty(keyWithWildCards, propertiesWithWildCards.getProperty(keyWithWildCards));
    		}
    	}
    	
    	return properties;
    }
protected Properties expandWildCards(Properties properties) {
    	Properties propertiesWithWildCards = new Properties() { // sorted properties
			private static final long serialVersionUID = 7793482336210629858L;

			@Override
		    public synchronized Enumeration<Object> keys() {
		        return Collections.enumeration(new TreeSet<Object>(super.keySet()));
		    }
		};
    	String key;
    	
    	// retrieve the keys with WildCards
		Enumeration<Object> e = properties.keys();
   		while (e.hasMoreElements()) {
    		key = (String) e.nextElement();
    		if (isAWildCard(key)) {
    			propertiesWithWildCards.setProperty(key, properties.getProperty(key));
    			properties.remove(key);
    		}
    	}
    	
    	// try to replace the values of other keys matching the keys with WildCards
		Enumeration<Object> w = propertiesWithWildCards.keys();
   		while (w.hasMoreElements()) {
    		String keyWithWildCards = (String) w.nextElement();
    		String regex = wildcardToRegex(keyWithWildCards);

			String ignoreWildcardInVariablesPattern = "(.*)variables\\\\\\[(.*)\\\\\\]\\/variable\\\\\\[(.*)\\\\\\](.*)";
			Pattern p = Pattern.compile(ignoreWildcardInVariablesPattern);
			Matcher m = p.matcher(regex);
			if (m.matches()) {
				String variables = m.group(2);
				String variable = m.group(3);
				variables = variables.replace(".*", "\\*");
				variable = variable.replace(".*", "\\*");
				regex = m.group(1) + "variables\\[" + variables + "\\]/variable\\[" + variable + "\\]" + m.group(4);
			}

    		Boolean found = false;

    		e = properties.keys();
    	   	while (e.hasMoreElements()) {
    			key = (String) e.nextElement();
    			
    			if (Pattern.matches(regex, key)) {
    				found = true;
    				String value = (String) propertiesWithWildCards.getProperty(keyWithWildCards);
    				properties.setProperty(key, value);
    			}
    		}

    	   	// not found, we put back the expression with wild cards in the original list (false positive)
    	   	// this way the wildcard can still be used in a next pass and will be removed at the end by AbstractPackagingMojo.removeWildCards 
    		if (!found) {
    			properties.setProperty(keyWithWildCards, propertiesWithWildCards.getProperty(keyWithWildCards));
    		}
    	}
    	
    	return properties;
    }
<p>
This expands wild cards properties.<br /><br />
Both wildcard expressions and expressions to expand are present in the
same properties object.<br /><br />
<i>Example</i>
<ul>
<li><b>property with wildcard</b>: /root/element[*]/key=new_value</li>
<li><b>property matching</b>: /root/element[my_name]/key=old_value</li>
</ul>
will expand to:<br />
<ul>
<li><b>property after expansion</b>:
/root/element[my_name]/key=new_value</li>
</ul>
</p>

@param properties, the properties object with wildcard expressions and
expressions to expand
@return properties with expanded expressions, but without wildcard
expressions