public String replace(String input){
  int lastAppendPos=0;
  Matcher matcher=pattern.matcher(input);
  StringBuilder sb=new StringBuilder();
  while (matcher.find()) {
    sb.append(input,lastAppendPos,matcher.start());
    sb.append(getReplacement(matcher));
    lastAppendPos=matcher.end();
  }
  sb.append(input,lastAppendPos,input.length());
  return sb.toString();
}

public String replace ( String input ) { int lastAppendPos = 0 ; Matcher matcher = pattern . matcher ( input ) ; StringBuilder sb = new StringBuilder ( ) ; while ( matcher . find ( ) ) { sb . append ( input , lastAppendPos , matcher . start ( ) ) ; sb . append ( getReplacement ( matcher ) ) ; lastAppendPos = matcher . end ( ) ; } sb . append ( input , lastAppendPos , input . length ( ) ) ; return sb . toString ( ) ; }
replaces anything in the input string , based on the map specified for this replacer .
