Here's the source of String.replaceAll from OpenJDK 8:
public String replaceAll(String regex, String replacement) {
return Pattern.compile(regex).matcher(this).replaceAll(replacement);
}
Here's the source of StringUtils.replacePattern:
public static String replacePattern(final String source, final String regex, final String replacement) {
return Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll(replacement);
}
The only difference between these methods is that replacePattern passes the DOTALL option and replaceAll doesn't.