@Override
        public CharSequence normalize(CharSequence charSequence) {
            String modified = URL_REGEX.matcher(charSequence).replaceAll(" ");
            return MAIL_REGEX.matcher(modified).replaceAll(" ");
        }
This will buffer up to {@link #setMaxLength(int)} and then
ignore the rest of the text.

@param cbuf Character buffer
@param off  Offset into cbuf to first character in the run of text
@param len  Number of characters in the run of text.
tika-langdetect/tika-langdetect-opennlp/src/main/java/org/apache/tika/langdetect/opennlp/OpenNLPDetector.java