/** * Appends a literal part of the input plus a replacement for the current * match to a given {@link StringBuffer}. The literal part is exactly the * part of the input between the previous match and the current match. The * method can be used in conjunction with {@link #find()} and * {@link #appendTail(StringBuffer)} to walk through the input and replace * all occurrences of the {@code Pattern} with something else. * * @param buffer * the {@code StringBuffer} to append to. * @param replacement * the replacement text. * @return the {@code Matcher} itself. * @throws IllegalStateException * if no successful match has been made. */ public Matcher appendReplacement(StringBuffer buffer, String replacement) { buffer.append(input.substring(appendPos, start())); appendEvaluated(buffer, replacement); appendPos = end(); return this; }
/** * Appends a literal part of the input plus a replacement for the current * match to a given {@link StringBuffer}. The literal part is exactly the * part of the input between the previous match and the current match. The * method can be used in conjunction with {@link #find()} and * {@link #appendTail(StringBuffer)} to walk through the input and replace * all occurrences of the {@code Pattern} with something else. * * @param buffer * the {@code StringBuffer} to append to. * @param replacement * the replacement text. * @return the {@code Matcher} itself. * @throws IllegalStateException * if no successful match has been made. */ public Matcher appendReplacement(StringBuffer buffer, String replacement) { buffer.append(input.substring(appendPos, start())); appendEvaluated(buffer, replacement); appendPos = end(); return this; }
/** * Appends a literal part of the input plus a replacement for the current * match to a given {@link StringBuffer}. The literal part is exactly the * part of the input between the previous match and the current match. The * method can be used in conjunction with {@link #find()} and * {@link #appendTail(StringBuffer)} to walk through the input and replace * all occurrences of the {@code Pattern} with something else. * * @param buffer * the {@code StringBuffer} to append to. * @param replacement * the replacement text. * @return the {@code Matcher} itself. * @throws IllegalStateException * if no successful match has been made. */ public Matcher appendReplacement(StringBuffer buffer, String replacement) { buffer.append(input.substring(appendPos, start())); appendEvaluated(buffer, replacement); appendPos = end(); return this; }
/** * Appends a literal part of the input plus a replacement for the current * match to a given {@link StringBuffer}. The literal part is exactly the * part of the input between the previous match and the current match. The * method can be used in conjunction with {@link #find()} and * {@link #appendTail(StringBuffer)} to walk through the input and replace * all occurrences of the {@code Pattern} with something else. * * @param buffer * the {@code StringBuffer} to append to. * @param replacement * the replacement text. * @return the {@code Matcher} itself. * @throws IllegalStateException * if no successful match has been made. */ public Matcher appendReplacement(StringBuffer buffer, String replacement) { buffer.append(input.substring(appendPos, start())); appendEvaluated(buffer, replacement); appendPos = end(); return this; }
/** * Appends a literal part of the input plus a replacement for the current * match to a given {@link StringBuffer}. The literal part is exactly the * part of the input between the previous match and the current match. The * method can be used in conjunction with {@link #find()} and * {@link #appendTail(StringBuffer)} to walk through the input and replace * all occurrences of the {@code Pattern} with something else. * * @param buffer * the {@code StringBuffer} to append to. * @param replacement * the replacement text. * @return the {@code Matcher} itself. * @throws IllegalStateException * if no successful match has been made. */ public Matcher appendReplacement(StringBuffer buffer, String replacement) { buffer.append(input.substring(appendPos, start())); appendEvaluated(buffer, replacement); appendPos = end(); return this; }
/** * Appends a literal part of the input plus a replacement for the current * match to a given {@link StringBuffer}. The literal part is exactly the * part of the input between the previous match and the current match. The * method can be used in conjunction with {@link #find()} and * {@link #appendTail(StringBuffer)} to walk through the input and replace * all occurrences of the {@code Pattern} with something else. * * @param buffer * the {@code StringBuffer} to append to. * @param replacement * the replacement text. * @return the {@code Matcher} itself. * @throws IllegalStateException * if no successful match has been made. */ public Matcher appendReplacement(StringBuffer buffer, String replacement) { buffer.append(input.substring(appendPos, start())); appendEvaluated(buffer, replacement); appendPos = end(); return this; }
/** * Appends a literal part of the input plus a replacement for the current * match to a given {@link StringBuffer}. The literal part is exactly the * part of the input between the previous match and the current match. The * method can be used in conjunction with {@link #find()} and * {@link #appendTail(StringBuffer)} to walk through the input and replace * all occurrences of the {@code Pattern} with something else. * * @param buffer * the {@code StringBuffer} to append to. * @param replacement * the replacement text. * @return the {@code Matcher} itself. * @throws IllegalStateException * if no successful match has been made. */ public Matcher appendReplacement(StringBuffer buffer, String replacement) { buffer.append(input.substring(appendPos, start())); appendEvaluated(buffer, replacement); appendPos = end(); return this; }