if (textSegmentCount > 0) {
// pull off leading spaces
Matcher m = LEADING_SPACES.matcher(textSegments.get(0));
String leadingSpaces = "";
if (m.matches()) {
leadingSpaces = exteriorSpaceOperator.apply(m.group(1));
textSegments.set(0, m.group(2));
}
// pull off trailing spaces
m = TRAILING_SPACES.matcher(textSegments.get(textSegmentCount - 1));