bool t4p::FinderClass::GetLastReplacementText(const UnicodeString& text, UnicodeString& replacementText) const { UBool matchFound = FALSE; if (IsFound && (LastPosition + LastLength) <= text.length()) { UnicodeString matchedText(text, LastPosition, LastLength); UnicodeString replaceWith = ReplaceExpression; UErrorCode error = U_ZERO_ERROR; RegexMatcher* matcher = NULL; switch (Mode) { case EXACT: matchFound = Expression == matchedText; if (matchFound) { replacementText = replaceWith; } break; case REGULAR_EXPRESSION: matcher = Pattern->matcher(matchedText, error); if (U_SUCCESS(error) && matcher && matcher->matches(error) && U_SUCCESS(error)) { replacementText = matcher->replaceFirst(replaceWith, error); matchFound = TRUE; } break; } if (matcher) { delete matcher; } } return matchFound == TRUE; }