textsearch.cxx (19716b0a) textsearch.cxx (2c1e93e7)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 802 unchanged lines hidden (view full) ---

811 UErrorCode nIcuErr = U_ZERO_ERROR;
812 const IcuUniString aSearchTargetStr( (const UChar*)searchStr.getStr(), startPos);
813 pRegexMatcher->reset( aSearchTargetStr);
814 if( !pRegexMatcher->find( endPos, nIcuErr))
815 return aRet;
816
817 // find the last match
818 int nLastPos = 0;
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 802 unchanged lines hidden (view full) ---

811 UErrorCode nIcuErr = U_ZERO_ERROR;
812 const IcuUniString aSearchTargetStr( (const UChar*)searchStr.getStr(), startPos);
813 pRegexMatcher->reset( aSearchTargetStr);
814 if( !pRegexMatcher->find( endPos, nIcuErr))
815 return aRet;
816
817 // find the last match
818 int nLastPos = 0;
819 int nFoundEnd = 0;
819 do {
820 nLastPos = pRegexMatcher->start( nIcuErr);
820 do {
821 nLastPos = pRegexMatcher->start( nIcuErr);
821 } while( pRegexMatcher->find( nLastPos + 1, nIcuErr));
822 nFoundEnd = pRegexMatcher->end( nIcuErr);
823 if( nFoundEnd >= startPos)
824 break;
825 if( nFoundEnd == nLastPos)
826 ++nFoundEnd;
827 } while( pRegexMatcher->find( nFoundEnd, nIcuErr));
822
823 // find last match again to get its details
824 pRegexMatcher->find( nLastPos, nIcuErr);
825
826 // fill in the details of the last match
827 const int nGroupCount = pRegexMatcher->groupCount();
828 aRet.subRegExpressions = nGroupCount + 1;
829 aRet.startOffset.realloc( aRet.subRegExpressions);

--- 191 unchanged lines hidden ---
828
829 // find last match again to get its details
830 pRegexMatcher->find( nLastPos, nIcuErr);
831
832 // fill in the details of the last match
833 const int nGroupCount = pRegexMatcher->groupCount();
834 aRet.subRegExpressions = nGroupCount + 1;
835 aRet.startOffset.realloc( aRet.subRegExpressions);

--- 191 unchanged lines hidden ---