From afb730458f7ffd6ca5049e9cf9d8d38ad93789ae Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Thu, 5 Aug 2004 22:46:52 +0000 Subject: [PATCH] ICU-4045 regexp::find(), fix incorrect resut when called repeatedly at end of input string. X-SVN-Rev: 16117 --- icu4c/source/i18n/uregex.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/icu4c/source/i18n/uregex.cpp b/icu4c/source/i18n/uregex.cpp index 727afb022d1..3a38d9de49d 100644 --- a/icu4c/source/i18n/uregex.cpp +++ b/icu4c/source/i18n/uregex.cpp @@ -885,6 +885,11 @@ int32_t RegexCImpl::appendTail(URegularExpression *regexp, // The last call to find() on this matcher failed(). // Look back to the end of the last find() that succeeded for src index. srcIdx = m->fLastMatchEnd; + if (srcIdx == -1) { + // There has been no successful match with this matcher. + // We want to copy the whole string. + srcIdx = 0; + } } int32_t destIdx = 0;