public static String replaceAll ( String pattern , CharSequence input , String replacement ) { input = new InterruptibleCharSequence ( input ) ; Matcher m = getMatcher ( pattern , input ) ; String res = m . replaceAll ( replacement ) ; recycleMatcher ( m ) ; return res ; }
Utility method using a precompiled pattern instead of using the replaceAll method of the String class . This method will also be reusing Matcher objects .