private String interpretReplaceEscapes(String replaceText,String foundText){
  int length=replaceText.length();
  boolean inEscape=false;
  StringBuffer buf=new StringBuffer(length);
  fRetainCaseMode=RC_MIXED;
  for (int i=0; i < length; i++) {
    final char ch=replaceText.charAt(i);
    if (inEscape) {
      i=interpretReplaceEscape(ch,i,buf,replaceText,foundText);
      inEscape=false;
    }
 else     if (ch == '\\') {
      inEscape=true;
    }
 else     if (ch == '$') {
      buf.append(ch);
      if (i + 2 < length) {
        char ch1=replaceText.charAt(i + 1);
        char ch2=replaceText.charAt(i + 2);
        if (ch1 == '0' && '0' <= ch2 && ch2 <= '9') {
          buf.append("0\\");
          i++;
        }
      }
    }
 else {
      interpretRetainCase(buf,ch);
    }
  }
  if (inEscape) {
    buf.append('\\');
  }
  return buf.toString();
}

private String interpretReplaceEscapes ( String replaceText , String foundText ) { int length = replaceText . length ( ) ; boolean inEscape = false ; StringBuffer buf = new StringBuffer ( length ) ; fRetainCaseMode = RC_MIXED ; for ( int i = 0 ; i < length ; i ++ ) { final char ch = replaceText . charAt ( i ) ; if ( inEscape ) { i = interpretReplaceEscape ( ch , i , buf , replaceText , foundText ) ; inEscape = false ; } else if ( ch == '\\' ) { inEscape = true ; } else if ( ch == '$' ) { buf . append ( ch ) ; if ( i + 2 < length ) { char ch1 = replaceText . charAt ( i + 1 ) ; char ch2 = replaceText . charAt ( i + 2 ) ; if ( ch1 == '0' && '0' <= ch2 && ch2 <= '9' ) { buf . append ( "0\\" ) ; i ++ ; } } } else { interpretRetainCase ( buf , ch ) ; } } if ( inEscape ) { buf . append ( '\\' ) ; } return buf . toString ( ) ; }
interprets escaped characters in the given replace pattern .
