/** */ public int replace(MatchResult res, String groupName, StringBuilder sb) { return replace(res, groupName, wrap(sb)); }
/** */ public int replace(MatchResult res, int group, StringBuilder sb) { return replace(res, group, wrap(sb)); }
/** * Replaces the first match this Matcher can find with replacement, as interpreted by PerlSubstitution (so $1 refers * to the first group and so on). Advances the search position for this Matcher, so it can also be used to * repeatedly replace the next match when called successively. * @param replacement the String to replace the first match with * @return this Matcher's String it operated on, after a replacement */ public String replaceFirst(Substitution replacement) { TextBuffer tb = wrap(new StringBuilder(data.length)); Replacer.replace(this, replacement, tb, 1); return tb.toString(); }
public StringBuffer appendTail(StringBuffer sb) { matcher.getGroup(regexodus.MatchResult.TARGET, Replacer.wrap(sb)); return sb; }
/** */ public int replace(char[] chars, int off, int len, StringBuilder sb) { return replace(chars, off, len, wrap(sb)); }
/** * Replaces all matches this Matcher can find with replacement, as interpreted by PerlSubstitution (so $1 refers to * the first group and so on). * @param replacement the String to replace the first match with * @return this Matcher's String it operated on, after replacements */ public String replaceAll(Substitution replacement) { TextBuffer tb = wrap(new StringBuilder(data.length)); Replacer.replace(this, replacement, tb); return tb.toString(); }
/** * Takes all instances in text of the Pattern this was constructed with, and replaces them with substitution. * @param text a String, StringBuilder, or other CharSequence that may contain the text to replace * @return the post-replacement text */ public String replace(CharSequence text) { TextBuffer tb = wrap(new StringBuilder(text.length())); replace(pattern.matcher(text), substitution, tb); return tb.toString(); }
/** * Takes all instances in text of the Pattern this was constructed with, and replaces them with substitution. * @param text a String, StringBuilder, or other CharSequence that may contain the text to replace * @return the post-replacement text */ public String replace(CharSequence text) { TextBuffer tb = wrap(new StringBuilder(text.length())); replace(pattern.matcher(text), substitution, tb); return tb.toString(); }
public String value(MatchResult mr) { TextBuffer dest = Replacer.wrap(new StringBuilder(mr.length())); appendSubstitution(mr, dest); return dest.toString(); }
public String replace(MatchResult res, int group) { TextBuffer tb = wrap(new StringBuilder()); replace(pattern.matcher(res, group), substitution, tb); return tb.toString(); }
public String replace(char[] chars, int off, int len) { TextBuffer tb = wrap(new StringBuilder(len)); replace(pattern.matcher(chars, off, len), substitution, tb); return tb.toString(); }
public String replace(char[] chars, int off, int len) { TextBuffer tb = wrap(new StringBuilder(len)); replace(pattern.matcher(chars, off, len), substitution, tb); return tb.toString(); }
public String replace(MatchResult res, int group) { TextBuffer tb = wrap(new StringBuilder()); replace(pattern.matcher(res, group), substitution, tb); return tb.toString(); }
public String value(MatchResult mr) { TextBuffer dest = Replacer.wrap(new StringBuilder(mr.length())); appendSubstitution(mr, dest); return dest.toString(); }
/** * Takes all occurrences of the pattern this was constructed with in text and replaces them with the substitution. * Appends the replaced text into sb. * @param text a String, StringBuilder, or other CharSequence that may contain the text to replace * @param sb the StringBuilder to append the result into * @return the number of individual replacements performed; the results are applied to sb */ public int replace(CharSequence text, StringBuilder sb) { return replace(pattern.matcher(text), substitution, wrap(sb)); }
@GwtIncompatible private static int replace(Matcher m, Substitution substitution, Writer out) throws IOException { try { return replace(m, substitution, wrap(out)); } catch (WriteException e) { throw e.reason; } }
/** * Takes all occurrences of the pattern this was constructed with in text and replaces them with the substitution. * Appends the replaced text into sb. * @param text a String, StringBuilder, or other CharSequence that may contain the text to replace * @param sb the StringBuilder to append the result into * @return the number of individual replacements performed; the results are applied to sb */ public int replace(CharSequence text, StringBuilder sb) { return replace(pattern.matcher(text), substitution, wrap(sb)); }
@GwtIncompatible public String replace(Reader text, int length) throws IOException { TextBuffer tb = wrap(new StringBuilder(length >= 0 ? length : 0)); replace(pattern.matcher(text, length), substitution, tb); return tb.toString(); }
/** * Takes instances in text of the Pattern this was constructed with, up to count times, and replaces them with the * substitution. Appends the replaced text into sb. * @param text a String, StringBuilder, or other CharSequence that may contain the text to replace * @param sb the StringBuilder to append the result into * @param count the maximum number of replacements to perform; will make no changes if less than 1 * @return the number of individual replacements performed; the results are applied to sb */ public int replace(CharSequence text, StringBuilder sb, int count) { return replace(pattern.matcher(text), substitution, wrap(sb), count); }
public Matcher appendReplacement(StringBuffer sb, String replacement) { Replacer rep = internalPattern.replacer(replacement); Replacer.replaceStep(matcher, new PerlSubstitution(replacement), Replacer.wrap(sb)); return this; }