public String replaceTokens(String queryString,String replacement,String... nonReplacementTokenPrefixes){
  Matcher matcher=tokenPattern.matcher(queryString);
  StringBuffer buf=new StringBuffer();
  while (matcher.find()) {
    String origToken=matcher.group(1);
    if (origToken != null) {
      matcher.appendReplacement(buf,"");
      if (tokenStartsWithPrefix(origToken,nonReplacementTokenPrefixes)) {
        buf.append("${" + origToken + "}");
      }
 else {
        buf.append(replacement);
      }
    }
  }
  matcher.appendTail(buf);
  return buf.toString();
}

public String replaceTokens ( String queryString , String replacement , String ... nonReplacementTokenPrefixes ) { Matcher matcher = tokenPattern . matcher ( queryString ) ; StringBuffer buf = new StringBuffer ( ) ; while ( matcher . find ( ) ) { String origToken = matcher . group ( 1 ) ; if ( origToken != null ) { matcher . appendReplacement ( buf , "" ) ; if ( tokenStartsWithPrefix ( origToken , nonReplacementTokenPrefixes ) ) { buf . append ( "${" + origToken + "}" ) ; } else { buf . append ( replacement ) ; } } } matcher . appendTail ( buf ) ; return buf . toString ( ) ; }
replaces a query string with tokens of format $ { token - name } with the specified replacement string for all tokens .
