The appendTail(StringBuffer sb) method

This method reads characters from the input sequence, starting at the append position, and appends them to the given string buffer. It is intended to be invoked after one or more invocations of the appendReplacement method in order to copy the remainder of the input sequence.

Just like in the case of the appendReplacement() method, there is also an overloaded version of the appendTail() method that accepts StringBuilder, which is not synchronized, instead of StringBuffer, which is synchronized.

Get Java 9 Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.