/** */ private int replace(char[] chars, int off, int len, TextBuffer dest) { return replace(pattern.matcher(chars, off, len), substitution, dest); }
/** */ private int replace(MatchResult res, String groupName, TextBuffer dest) { return replace(pattern.matcher(res, groupName), substitution, dest); }
/** * A shorthand for Pattern.matcher(String).matches().<br> * * @param s the target * @return true if the entire target matches the pattern * @see Matcher#matches() * @see Matcher#matches(String) */ public boolean matches(String s) { return matcher(s).matches(); }
/** * A shorthand for Pattern.matcher(String).matchesPrefix().<br> * * @param s the target * @return true if the entire target matches the beginning of the pattern * @see Matcher#matchesPrefix() */ public boolean startsWith(String s) { return matcher(s).matchesPrefix(); }
/** */ private int replace(MatchResult res, int group, TextBuffer dest) { return replace(pattern.matcher(res, group), substitution, dest); }
/** */ public int replace(CharSequence text, TextBuffer dest) { return replace(pattern.matcher(text), substitution, dest); }
/** */ private int replace(MatchResult res, int group, TextBuffer dest) { return replace(pattern.matcher(res, group), substitution, dest); }
/** * A shorthand for Pattern.matcher(String).matches().<br> * * @param s the target * @return true if the entire target matches the pattern * @see Matcher#matches() * @see Matcher#matches(String) */ public boolean matches(String s) { return matcher(s).matches(); }
/** * 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 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(); }
/** * Just as above, yet with symbolic group name. * * @throws NullPointerException if there is no group with such name */ public Matcher matcher(MatchResult res, String groupName) { Integer id = res.pattern().groupId(groupName); if (id == null) throw new IllegalArgumentException("group not found:" + groupName); int group = id; return matcher(res, group); }
/** * Just as above, yet with symbolic group name. * * @throws NullPointerException if there is no group with such name */ public Matcher matcher(MatchResult res, String groupName) { Integer id = res.pattern().groupId(groupName); if (id == null) throw new IllegalArgumentException("group not found:" + groupName); int group = id; return matcher(res, group); }
/** * 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); }
protected static boolean checkAll(CharSequence testing, Pattern[] checks) { CharSequence fixed = removeAccents(testing); for (int i = 0; i < checks.length; i++) { if (checks[i].matcher(fixed).find()) return false; } return true; }
@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); }