@Override
    public String perform(String[] args, String data, Map<String, Map<String, String>> replacementsMap) {
      if ((args == null) || (args.length != 2)) {
        throw new IllegalArgumentException("Invalid number of arguments encountered");
      }
      if (data != null) {
        StringBuffer builder = new StringBuffer();
        String regex = args[0];
        String replacement = args[1];
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(data);
        while (matcher.find()) {
          matcher.appendReplacement(builder, replacement);
        }
        matcher.appendTail(builder);
        return builder.toString();
      }
      return "";
    }
ReplaceValue is a Function implementation that replaces the value in the string
<p/>
This function expects the following arguments (in order) within the args array:
<ol>
<li>regular expression that should be replaced</li>
<li>replacement value for the string</li>
</ol>
ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelper.java