List of utility methods to do Regex String Replace All
String | replaceAll(final String regex, final String replaceWith, final String subject) a method to do a CASE INSENSITIVE regex search-replace final Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); final Matcher m = p.matcher(subject); return m.replaceAll(replaceWith); |
String | replaceAll(final String regex, final String text, final String replacement) replace All final Pattern compiledRegex = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); return compiledRegex.matcher(text).replaceAll(replacement); |
String | replaceAll(Pattern p, String s, String r, Function Replaces all occurrences of the pattern in this input Matcher m = p.matcher(s); while (m.find()) { s = m.replaceFirst(String.format(r, cb.apply(m))); m = p.matcher(s); return s; |
String | replaceAll(Pattern pattern, String string, String replacement) replace All return pattern.matcher(string).replaceAll(replacement);
|
String | replaceAll(String original, String regexWhat, String with) replace All Pattern p = Pattern.compile(regexWhat);
Matcher m = p.matcher(original);
return m.replaceAll(with);
|
String | replaceAll(String regex, String ment, String str) replace All return replaceAll(regex, ment, str, Pattern.CASE_INSENSITIVE);
|
String | replaceAll(String regex, String str, Map replace All String replacement = null; Matcher m = Pattern.compile(regex).matcher(str); if (m.find()) { replacement = map.get(m.group(1)); return m.replaceAll(replacement); |
String | replaceAll(String regularExpression, String string, String newValue) replace All List<String> matches = new ArrayList<String>(); Pattern pattern = Pattern.compile(regularExpression); Matcher matcher = pattern.matcher(string); while (matcher.find()) { matches.add(matcher.group(1)); for (String item : matches) { string = string.replace(item, newValue); ... |
String | replaceAll(String source, Pattern pattern, String replace) replace All Matcher matcher; synchronized (pattern) { matcher = pattern.matcher(source); return matcher.replaceAll(replace); |
String | replaceAll(String str, String originalToken, String replacementToken) Replaces all occurrances of this originalToken in this string with this replacementToken. return str.replaceAll(Pattern.quote(originalToken), Matcher.quoteReplacement(replacementToken));
|