I am trying to know the pros and cons of using apache.commons.StringUtils.replacePattern() instead of the java.lang.String.replaceAll() function.
I heard that the replacePattern() function improves the performance but I could not find that stated in any of the javaDocs or in any of the popular java forums. Please let me know if there are any other advantages of using the replacePattern() method.
Here's the source of String.replaceAll from OpenJDK 8:
Here's the source of StringUtils.replacePattern:
The only difference between these methods is that replacePattern passes the DOTALL option and replaceAll doesn't.