Lines Matching +full:escape +full:- +full:string +full:- +full:regexp
5 * Copyright (C) 2004-2015, International Business Machines
32 #define REMAINING_CAPACITY(idx,len) ((((len)-(idx))>0)?((len)-(idx)):0)
46 // may be -1.
82 //----------------------------------------------------------------------------------------
86 //----------------------------------------------------------------------------------------
91 if (re == NULL || re->fMagic != REXP_MAGIC) { in validateRE()
95 …// !!! Not sure how to update this with the new UText backing, which is stored in re->fMatcher any… in validateRE()
96 if (requiresText && re->fText == NULL && !re->fOwnsText) { in validateRE()
103 //----------------------------------------------------------------------------------------
107 //----------------------------------------------------------------------------------------
118 if (pattern == NULL || patternLength < -1 || patternLength == 0) { in uregex_open()
123 if (actualPatLen == -1) { in uregex_open()
137 re->fPatRefCount = refC; in uregex_open()
138 *re->fPatRefCount = 1; in uregex_open()
141 // Make a copy of the pattern string, so we can return it later if asked. in uregex_open()
145 re->fPatString = patBuf; in uregex_open()
146 re->fPatStringLen = patternLength; in uregex_open()
157 re->fPat = RegexPattern::compile(&patText, flags, *pe, *status); in uregex_open()
159 re->fPat = RegexPattern::compile(&patText, flags, *status); in uregex_open()
170 re->fMatcher = re->fPat->matcher(*status); in uregex_open()
181 //----------------------------------------------------------------------------------------
185 //----------------------------------------------------------------------------------------
221 re->fPatRefCount = refC; in uregex_openUText()
222 *re->fPatRefCount = 1; in uregex_openUText()
225 // Make a copy of the pattern string, so we can return it later if asked. in uregex_openUText()
226 // For compiling the pattern, we will use a read-only UText wrapper in uregex_openUText()
229 re->fPatString = patBuf; in uregex_openUText()
230 re->fPatStringLen = pattern16Length; in uregex_openUText()
240 re->fPat = RegexPattern::compile(&patText, flags, *pe, *status); in uregex_openUText()
242 re->fPat = RegexPattern::compile(&patText, flags, *status); in uregex_openUText()
253 re->fMatcher = re->fPat->matcher(*status); in uregex_openUText()
264 //----------------------------------------------------------------------------------------
268 //----------------------------------------------------------------------------------------
280 //----------------------------------------------------------------------------------------
284 //----------------------------------------------------------------------------------------
298 clone->fMatcher = source->fPat->matcher(*status); in uregex_clone()
304 clone->fPat = source->fPat; in uregex_clone()
305 clone->fPatRefCount = source->fPatRefCount; in uregex_clone()
306 clone->fPatString = source->fPatString; in uregex_clone()
307 clone->fPatStringLen = source->fPatStringLen; in uregex_clone()
308 umtx_atomic_inc(source->fPatRefCount); in uregex_clone()
317 //------------------------------------------------------------------------------
321 //------------------------------------------------------------------------------
326 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_pattern() local
328 if (validateRE(regexp, false, status) == false) { in uregex_pattern()
332 *patLength = regexp->fPatStringLen; in uregex_pattern()
334 return regexp->fPatString; in uregex_pattern()
338 //------------------------------------------------------------------------------
342 //------------------------------------------------------------------------------
346 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_patternUText() local
347 return regexp->fPat->patternText(*status); in uregex_patternUText()
351 //------------------------------------------------------------------------------
355 //------------------------------------------------------------------------------
358 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_flags() local
359 if (validateRE(regexp, false, status) == false) { in uregex_flags()
362 int32_t flags = regexp->fPat->flags(); in uregex_flags()
367 //------------------------------------------------------------------------------
371 //------------------------------------------------------------------------------
377 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setText() local
378 if (validateRE(regexp, false, status) == false) { in uregex_setText()
381 if (text == NULL || textLength < -1) { in uregex_setText()
386 if (regexp->fOwnsText && regexp->fText != NULL) { in uregex_setText()
387 uprv_free((void *)regexp->fText); in uregex_setText()
390 regexp->fText = text; in uregex_setText()
391 regexp->fTextLength = textLength; in uregex_setText()
392 regexp->fOwnsText = false; in uregex_setText()
396 regexp->fMatcher->reset(&input); in uregex_setText()
401 //------------------------------------------------------------------------------
405 //------------------------------------------------------------------------------
410 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setUText() local
411 if (validateRE(regexp, false, status) == false) { in uregex_setUText()
419 if (regexp->fOwnsText && regexp->fText != NULL) { in uregex_setUText()
420 uprv_free((void *)regexp->fText); in uregex_setUText()
423 regexp->fText = NULL; // only fill it in on request in uregex_setUText()
424 regexp->fTextLength = -1; in uregex_setUText()
425 regexp->fOwnsText = true; in uregex_setUText()
426 regexp->fMatcher->reset(text); in uregex_setUText()
431 //------------------------------------------------------------------------------
435 //------------------------------------------------------------------------------
440 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_getText() local
441 if (validateRE(regexp, false, status) == false) { in uregex_getText()
445 if (regexp->fText == NULL) { in uregex_getText()
447 UText *inputText = regexp->fMatcher->inputText(); in uregex_getText()
450 regexp->fText = inputText->chunkContents; in uregex_getText()
451 regexp->fTextLength = (int32_t)inputNativeLength; in uregex_getText()
452 regexp->fOwnsText = false; // because the UText owns it in uregex_getText()
455 …regexp->fTextLength = utext_extract(inputText, 0, inputNativeLength, NULL, 0, &lengthStatus); // b… in uregex_getText()
456 UChar *inputChars = (UChar *)uprv_malloc(sizeof(UChar)*(regexp->fTextLength+1)); in uregex_getText()
458 … utext_extract(inputText, 0, inputNativeLength, inputChars, regexp->fTextLength+1, status); in uregex_getText()
459 regexp->fText = inputChars; in uregex_getText()
460 regexp->fOwnsText = true; // should already be set but just in case in uregex_getText()
465 *textLength = regexp->fTextLength; in uregex_getText()
467 return regexp->fText; in uregex_getText()
471 //------------------------------------------------------------------------------
475 //------------------------------------------------------------------------------
480 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_getUText() local
481 if (validateRE(regexp, false, status) == false) { in uregex_getUText()
484 return regexp->fMatcher->getInput(dest, *status); in uregex_getUText()
488 //------------------------------------------------------------------------------
492 //------------------------------------------------------------------------------
497 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_refreshUText() local
498 if (validateRE(regexp, false, status) == false) { in uregex_refreshUText()
501 regexp->fMatcher->refreshInputText(text, *status); in uregex_refreshUText()
505 //------------------------------------------------------------------------------
509 //------------------------------------------------------------------------------
521 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_matches64() local
523 if (validateRE(regexp, true, status) == false) { in uregex_matches64()
526 if (startIndex == -1) { in uregex_matches64()
527 result = regexp->fMatcher->matches(*status); in uregex_matches64()
529 result = regexp->fMatcher->matches(startIndex, *status); in uregex_matches64()
535 //------------------------------------------------------------------------------
539 //------------------------------------------------------------------------------
551 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_lookingAt64() local
553 if (validateRE(regexp, true, status) == false) { in uregex_lookingAt64()
556 if (startIndex == -1) { in uregex_lookingAt64()
557 result = regexp->fMatcher->lookingAt(*status); in uregex_lookingAt64()
559 result = regexp->fMatcher->lookingAt(startIndex, *status); in uregex_lookingAt64()
566 //------------------------------------------------------------------------------
570 //------------------------------------------------------------------------------
582 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_find64() local
584 if (validateRE(regexp, true, status) == false) { in uregex_find64()
587 if (startIndex == -1) { in uregex_find64()
588 regexp->fMatcher->resetPreserveRegion(); in uregex_find64()
589 result = regexp->fMatcher->find(*status); in uregex_find64()
591 result = regexp->fMatcher->find(startIndex, *status); in uregex_find64()
597 //------------------------------------------------------------------------------
601 //------------------------------------------------------------------------------
605 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_findNext() local
606 if (validateRE(regexp, true, status) == false) { in uregex_findNext()
609 UBool result = regexp->fMatcher->find(*status); in uregex_findNext()
613 //------------------------------------------------------------------------------
617 //------------------------------------------------------------------------------
621 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_groupCount() local
622 if (validateRE(regexp, false, status) == false) { in uregex_groupCount()
625 int32_t result = regexp->fMatcher->groupCount(); in uregex_groupCount()
630 //------------------------------------------------------------------------------
634 //------------------------------------------------------------------------------
640 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_groupNumberFromName() local
641 if (validateRE(regexp, false, status) == false) { in uregex_groupNumberFromName()
644 …int32_t result = regexp->fPat->groupNumberFromName(UnicodeString(groupName, nameLength), *status); in uregex_groupNumberFromName()
653 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_groupNumberFromCName() local
654 if (validateRE(regexp, false, status) == false) { in uregex_groupNumberFromCName()
657 return regexp->fPat->groupNumberFromName(groupName, nameLength, *status); in uregex_groupNumberFromCName()
660 //------------------------------------------------------------------------------
664 //------------------------------------------------------------------------------
671 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_group() local
672 if (validateRE(regexp, true, status) == false) { in uregex_group()
680 if (destCapacity == 0 || regexp->fText != NULL) { in uregex_group()
687 int32_t startIx = regexp->fMatcher->start(groupNum, *status); in uregex_group()
688 int32_t endIx = regexp->fMatcher->end (groupNum, *status); in uregex_group()
696 int32_t fullLength = endIx - startIx; in uregex_group()
711 u_memcpy(dest, ®exp->fText[startIx], copyLength); in uregex_group()
715 int64_t start = regexp->fMatcher->start64(groupNum, *status); in uregex_group()
716 int64_t limit = regexp->fMatcher->end64(groupNum, *status); in uregex_group()
721 … // Group didn't match: start == end == -1. UText trims to 0, UText gives zero length result. in uregex_group()
723 …int32_t length = utext_extract(regexp->fMatcher->inputText(), start, limit, dest, destCapacity, st… in uregex_group()
730 //------------------------------------------------------------------------------
734 //------------------------------------------------------------------------------
741 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_groupUText() local
742 if (validateRE(regexp, true, status) == false) { in uregex_groupUText()
747 return regexp->fMatcher->group(groupNum, dest, *groupLength, *status); in uregex_groupUText()
750 //------------------------------------------------------------------------------
754 //------------------------------------------------------------------------------
766 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_start64() local
767 if (validateRE(regexp, true, status) == false) { in uregex_start64()
770 int64_t result = regexp->fMatcher->start64(groupNum, *status); in uregex_start64()
774 //------------------------------------------------------------------------------
778 //------------------------------------------------------------------------------
790 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_end64() local
791 if (validateRE(regexp, true, status) == false) { in uregex_end64()
794 int64_t result = regexp->fMatcher->end64(groupNum, *status); in uregex_end64()
798 //------------------------------------------------------------------------------
802 //------------------------------------------------------------------------------
814 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_reset64() local
815 if (validateRE(regexp, true, status) == false) { in uregex_reset64()
818 regexp->fMatcher->reset(index, *status); in uregex_reset64()
822 //------------------------------------------------------------------------------
826 //------------------------------------------------------------------------------
840 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setRegion64() local
841 if (validateRE(regexp, true, status) == false) { in uregex_setRegion64()
844 regexp->fMatcher->region(regionStart, regionLimit, *status); in uregex_setRegion64()
848 //------------------------------------------------------------------------------
852 //------------------------------------------------------------------------------
859 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setRegionAndStart() local
860 if (validateRE(regexp, true, status) == false) { in uregex_setRegionAndStart()
863 regexp->fMatcher->region(regionStart, regionLimit, startIndex, *status); in uregex_setRegionAndStart()
866 //------------------------------------------------------------------------------
870 //------------------------------------------------------------------------------
880 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_regionStart64() local
881 if (validateRE(regexp, true, status) == false) { in uregex_regionStart64()
884 return regexp->fMatcher->regionStart(); in uregex_regionStart64()
888 //------------------------------------------------------------------------------
892 //------------------------------------------------------------------------------
902 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_regionEnd64() local
903 if (validateRE(regexp, true, status) == false) { in uregex_regionEnd64()
906 return regexp->fMatcher->regionEnd(); in uregex_regionEnd64()
910 //------------------------------------------------------------------------------
914 //------------------------------------------------------------------------------
918 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_hasTransparentBounds() local
919 if (validateRE(regexp, false, status) == false) { in uregex_hasTransparentBounds()
922 return regexp->fMatcher->hasTransparentBounds(); in uregex_hasTransparentBounds()
926 //------------------------------------------------------------------------------
930 //------------------------------------------------------------------------------
935 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_useTransparentBounds() local
936 if (validateRE(regexp, false, status) == false) { in uregex_useTransparentBounds()
939 regexp->fMatcher->useTransparentBounds(b); in uregex_useTransparentBounds()
943 //------------------------------------------------------------------------------
947 //------------------------------------------------------------------------------
951 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_hasAnchoringBounds() local
952 if (validateRE(regexp, false, status) == false) { in uregex_hasAnchoringBounds()
955 return regexp->fMatcher->hasAnchoringBounds(); in uregex_hasAnchoringBounds()
959 //------------------------------------------------------------------------------
963 //------------------------------------------------------------------------------
968 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_useAnchoringBounds() local
969 if (validateRE(regexp, false, status) == false) { in uregex_useAnchoringBounds()
972 regexp->fMatcher->useAnchoringBounds(b); in uregex_useAnchoringBounds()
976 //------------------------------------------------------------------------------
980 //------------------------------------------------------------------------------
984 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_hitEnd() local
985 if (validateRE(regexp, true, status) == false) { in uregex_hitEnd()
988 return regexp->fMatcher->hitEnd(); in uregex_hitEnd()
992 //------------------------------------------------------------------------------
996 //------------------------------------------------------------------------------
1000 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_requireEnd() local
1001 if (validateRE(regexp, true, status) == false) { in uregex_requireEnd()
1004 return regexp->fMatcher->requireEnd(); in uregex_requireEnd()
1008 //------------------------------------------------------------------------------
1012 //------------------------------------------------------------------------------
1017 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setTimeLimit() local
1018 if (validateRE(regexp, false, status)) { in uregex_setTimeLimit()
1019 regexp->fMatcher->setTimeLimit(limit, *status); in uregex_setTimeLimit()
1025 //------------------------------------------------------------------------------
1029 //------------------------------------------------------------------------------
1034 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_getTimeLimit() local
1035 if (validateRE(regexp, false, status)) { in uregex_getTimeLimit()
1036 retVal = regexp->fMatcher->getTimeLimit(); in uregex_getTimeLimit()
1043 //------------------------------------------------------------------------------
1047 //------------------------------------------------------------------------------
1052 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setStackLimit() local
1053 if (validateRE(regexp, false, status)) { in uregex_setStackLimit()
1054 regexp->fMatcher->setStackLimit(limit, *status); in uregex_setStackLimit()
1060 //------------------------------------------------------------------------------
1064 //------------------------------------------------------------------------------
1069 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_getStackLimit() local
1070 if (validateRE(regexp, false, status)) { in uregex_getStackLimit()
1071 retVal = regexp->fMatcher->getStackLimit(); in uregex_getStackLimit()
1077 //------------------------------------------------------------------------------
1081 //------------------------------------------------------------------------------
1087 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setMatchCallback() local
1088 if (validateRE(regexp, false, status)) { in uregex_setMatchCallback()
1089 regexp->fMatcher->setMatchCallback(callback, context, *status); in uregex_setMatchCallback()
1094 //------------------------------------------------------------------------------
1098 //------------------------------------------------------------------------------
1104 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_getMatchCallback() local
1105 if (validateRE(regexp, false, status)) { in uregex_getMatchCallback()
1106 regexp->fMatcher->getMatchCallback(*callback, *context, *status); in uregex_getMatchCallback()
1111 //------------------------------------------------------------------------------
1115 //------------------------------------------------------------------------------
1121 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_setFindProgressCallback() local
1122 if (validateRE(regexp, false, status)) { in uregex_setFindProgressCallback()
1123 regexp->fMatcher->setFindProgressCallback(callback, context, *status); in uregex_setFindProgressCallback()
1128 //------------------------------------------------------------------------------
1132 //------------------------------------------------------------------------------
1138 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_getFindProgressCallback() local
1139 if (validateRE(regexp, false, status)) { in uregex_getFindProgressCallback()
1140 regexp->fMatcher->getFindProgressCallback(*callback, *context, *status); in uregex_getFindProgressCallback()
1145 //------------------------------------------------------------------------------
1149 //------------------------------------------------------------------------------
1157 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_replaceAll() local
1158 if (validateRE(regexp, true, status) == false) { in uregex_replaceAll()
1161 if (replacementText == NULL || replacementLength < -1 || in uregex_replaceAll()
1195 //------------------------------------------------------------------------------
1199 //------------------------------------------------------------------------------
1205 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_replaceAllUText() local
1206 if (validateRE(regexp, true, status) == false) { in uregex_replaceAllUText()
1214 dest = regexp->fMatcher->replaceAll(replacementText, dest, *status); in uregex_replaceAllUText()
1219 //------------------------------------------------------------------------------
1223 //------------------------------------------------------------------------------
1231 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_replaceFirst() local
1232 if (validateRE(regexp, true, status) == false) { in uregex_replaceFirst()
1235 if (replacementText == NULL || replacementLength < -1 || in uregex_replaceFirst()
1256 //------------------------------------------------------------------------------
1260 //------------------------------------------------------------------------------
1266 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_replaceFirstUText() local
1267 if (validateRE(regexp, true, status) == false) { in uregex_replaceFirstUText()
1275 dest = regexp->fMatcher->replaceFirst(replacementText, dest, *status); in uregex_replaceFirstUText()
1280 //------------------------------------------------------------------------------
1284 //------------------------------------------------------------------------------
1289 // and stand-alone C functions don't work as friends
1293 inline static int32_t appendReplacement(RegularExpression *regexp,
1300 inline static int32_t appendTail(RegularExpression *regexp,
1305 inline static int32_t split(RegularExpression *regexp,
1339 int32_t RegexCImpl::appendReplacement(RegularExpression *regexp, in appendReplacement() argument
1358 if (validateRE(regexp, true, status) == false) { in appendReplacement()
1361 if (replacementText == NULL || replacementLength < -1 || in appendReplacement()
1369 RegexMatcher *m = regexp->fMatcher; in appendReplacement()
1370 if (m->fMatch == false) { in appendReplacement()
1383 if (replacementLength == -1) { in appendReplacement()
1387 // Copy input string from the end of previous match to start of current match in appendReplacement()
1388 if (regexp->fText != NULL) { in appendReplacement()
1391 if (UTEXT_USES_U16(m->fInputText)) { in appendReplacement()
1392 lastMatchEnd = (int32_t)m->fLastMatchEnd; in appendReplacement()
1393 matchStart = (int32_t)m->fMatchStart; in appendReplacement()
1397 lastMatchEnd = utext_extract(m->fInputText, 0, m->fLastMatchEnd, NULL, 0, &tempStatus); in appendReplacement()
1399 …matchStart = lastMatchEnd + utext_extract(m->fInputText, m->fLastMatchEnd, m->fMatchStart, NULL, 0… in appendReplacement()
1402 appendToBuf(regexp->fText[i], &destIdx, dest, capacity); in appendReplacement()
1406 destIdx += utext_extract(m->fInputText, m->fLastMatchEnd, m->fMatchStart, in appendReplacement()
1425 // Backslash Escape. Copy the following char out without further checks. in appendReplacement()
1436 // We have a \udddd or \Udddddddd escape sequence. in appendReplacement()
1452 // Note: if the \u escape was invalid, just fall through and in appendReplacement()
1453 // treat it as a plain \<anything> escape. in appendReplacement()
1456 // Plain backslash escape. Just put out the escaped character. in appendReplacement()
1468 UChar32 c32 = -1; in appendReplacement()
1474 int32_t numCaptureGroups = m->fPattern->fGroupMap->size(); in appendReplacement()
1511 groupNum = regexp->fPat->fNamedCaptureMap ? in appendReplacement()
1512 uhash_geti(regexp->fPat->fNamedCaptureMap, &groupName) : 0; in appendReplacement()
1530 destIdx += uregex_group((URegularExpression*)regexp, groupNum, in appendReplacement()
1566 *destCapacity -= destIdx; in appendReplacement()
1594 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_appendReplacement() local
1596 regexp, replacementText, replacementLength,destBuf, destCapacity, status); in uregex_appendReplacement()
1607 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_appendReplacementUText() local
1608 regexp->fMatcher->appendReplacement(dest, replText, *status); in uregex_appendReplacementUText()
1612 //------------------------------------------------------------------------------
1616 //------------------------------------------------------------------------------
1617 int32_t RegexCImpl::appendTail(RegularExpression *regexp, in appendTail() argument
1632 if (validateRE(regexp, true, status) == false) { in appendTail()
1644 RegexMatcher *m = regexp->fMatcher; in appendTail()
1650 if (regexp->fText != NULL) { in appendTail()
1652 int64_t nativeIdx = (m->fMatch ? m->fMatchEnd : m->fLastMatchEnd); in appendTail()
1653 if (nativeIdx == -1) { in appendTail()
1655 } else if (UTEXT_USES_U16(m->fInputText)) { in appendTail()
1659 srcIdx = utext_extract(m->fInputText, 0, nativeIdx, NULL, 0, &newStatus); in appendTail()
1665 if (srcIdx == regexp->fTextLength) { in appendTail()
1668 UChar c = regexp->fText[srcIdx]; in appendTail()
1669 if (c == 0 && regexp->fTextLength == -1) { in appendTail()
1670 regexp->fTextLength = srcIdx; in appendTail()
1678 // If the total input string length is known, we can in appendTail()
1679 // compute the total buffer size needed without scanning through the string. in appendTail()
1680 if (regexp->fTextLength > 0) { in appendTail()
1681 destIdx += (regexp->fTextLength - srcIdx); in appendTail()
1690 if (m->fMatch) { in appendTail()
1692 srcIdx = m->fMatchEnd; in appendTail()
1696 srcIdx = m->fLastMatchEnd; in appendTail()
1697 if (srcIdx == -1) { in appendTail()
1699 // We want to copy the whole string. in appendTail()
1704 destIdx = utext_extract(m->fInputText, srcIdx, m->fInputLength, dest, destCap, status); in appendTail()
1708 // NUL terminate the output string, if possible, otherwise issue the in appendTail()
1725 *destCapacity -= destIdx; in appendTail()
1747 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_appendTail() local
1748 return RegexCImpl::appendTail(regexp, destBuf, destCapacity, status); in uregex_appendTail()
1759 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_appendTailUText() local
1760 return regexp->fMatcher->appendTail(dest, *status); in uregex_appendTailUText()
1764 //------------------------------------------------------------------------------
1766 // copyString Internal utility to copy a string to an output buffer,
1771 //------------------------------------------------------------------------------
1777 const UChar *srcPtr, // Pointer to source string
1778 int32_t srcLen) // Source string len.
1790 di += srcLen - si;
1802 //------------------------------------------------------------------------------
1806 //------------------------------------------------------------------------------
1807 int32_t RegexCImpl::split(RegularExpression *regexp, in split() argument
1817 regexp->fMatcher->reset(); in split()
1818 UText *inputText = regexp->fMatcher->fInputText; in split()
1820 int64_t inputLen = regexp->fMatcher->fInputLength; in split()
1830 int32_t numCaptureGroups = regexp->fMatcher->groupCount(); in split()
1833 if (i>=destFieldsCapacity-1) { in split()
1835 // Fill the last output string with whatever is left from the input, then exit the loop. in split()
1839 // input string.) in split()
1841 if (i != destFieldsCapacity-1) { in split()
1843 // the input string. in split()
1844 i = destFieldsCapacity-1; in split()
1845 destIdx = (int32_t)(destFields[i] - destFields[0]); in split()
1855 if (regexp->fMatcher->find()) { in split()
1857 // up until the start of the delimiter into the next output string. in split()
1860 … destIdx += 1 + utext_extract(inputText, nextOutputStringStart, regexp->fMatcher->fMatchStart, in split()
1867 nextOutputStringStart = regexp->fMatcher->fMatchEnd; in split()
1873 // If we've run out of output string slots, bail out. in split()
1874 if (i==destFieldsCapacity-1) { in split()
1882 int32_t t = uregex_group((URegularExpression*)regexp, in split()
1887 destIdx += t + 1; // Record the space used in the output string buffer. in split()
1888 // +1 for the NUL that terminates the string. in split()
1897 // The delimiter was at the end of the string. in split()
1898 // Output an empty string, and then we are done. in split()
1902 if (i < destFieldsCapacity-1) { in split()
1916 // All the remaining text goes into the current output string. in split()
1950 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_split() local
1951 if (validateRE(regexp, true, status) == false) { in uregex_split()
1962 …return RegexCImpl::split(regexp, destBuf, destCapacity, requiredCapacity, destFields, destFieldsCa… in uregex_split()
1974 RegularExpression *regexp = (RegularExpression*)regexp2; in uregex_splitUText() local
1975 …return regexp->fMatcher->split(regexp->fMatcher->inputText(), destFields, destFieldsCapacity, *sta… in uregex_splitUText()