src/main/java/com/ruleoftech/markdown/page/generator/plugin/MdPageGeneratorMojo.java
private String substituteVariables(String template, String patternString, Map<String, String> variables) {
        Pattern pattern = Pattern.compile(patternString);
        Matcher matcher = pattern.matcher(template);
        StringBuffer buffer = new StringBuffer();
        while (matcher.find()) {
            if (variables.containsKey(matcher.group(1))) {
                String replacement = variables.get(matcher.group(1));
                // quote to work properly with $ and {,} signs
                matcher.appendReplacement(buffer, replacement != null ? Matcher.quoteReplacement(replacement) : "null");
            }
        }
        matcher.appendTail(buffer);
        return buffer.toString();
    }
private String substituteVariables(String template, String patternString, Map<String, String> variables) {
        Pattern pattern = Pattern.compile(patternString);
        Matcher matcher = pattern.matcher(template);
        StringBuffer buffer = new StringBuffer();
        while (matcher.find()) {
            if (variables.containsKey(matcher.group(1))) {
                String replacement = variables.get(matcher.group(1));
                // quote to work properly with $ and {,} signs
                matcher.appendReplacement(buffer, replacement != null ? Matcher.quoteReplacement(replacement) : "null");
            }
        }
        matcher.appendTail(buffer);
        return buffer.toString();
    }
private String substituteVariables ( String template , String patternString , Map < String , String > variables ) { Pattern pattern = Pattern . compile ( patternString ) ; Matcher matcher = pattern . matcher ( template ) ; StringBuffer buffer = new StringBuffer ( ) ; while ( matcher . find ( ) ) { if ( variables . containsKey ( matcher . group ( 1 ) ) ) { String replacement = variables . get ( matcher . group ( 1 ) ) ; // quote to work properly with $ and {,} signs matcher . appendReplacement ( buffer , replacement != null ? Matcher . quoteReplacement ( replacement ) : "null" ) ; } } matcher . appendTail ( buffer ) ; return buffer . toString ( ) ; }
Replace variables with given pattern.

@param template      String to replace
@param patternString regexp pattern
@param variables     variables to find
@return result
Replace variables with given pattern .