// how replace is implemented. // It uses regex techniques even though neither parameter is a regex. public String replace(CharSequence target, CharSequence replacement) { return Pattern.compile( target.toString(), Pattern.LITERAL ) .matcher( this ).replaceAll( Matcher.quoteReplacement( replacement.toString() ) );