Functions for extracting the prefix and tail of a message.