• Home
  • Raw
  • Download

Lines Matching refs:status

119 …xt* regextst_openUTF8FromInvariant(UText* ut, const char *inv, int64_t length, UErrorCode *status);
189 if (U_FAILURE(status)) { \
191 __FILE__, __LINE__, u_errorName(status)); \
203 UErrorCode status=U_ZERO_ERROR; \
205 if (status!=errcode) { \
207 __LINE__, u_errorName(errcode), u_errorName(status)); \
212 if (U_FAILURE(status)) { \
213 errln("RegexTest failure at line %d, from %d. status=%d\n",__LINE__, (line), status); \
254 UErrorCode status = U_ZERO_ERROR; in assertUText() local
256 utext_openUTF8(&expectedText, expected, -1, &status); in assertUText()
257 if(U_FAILURE(status)) { in assertUText()
258 …s calling utext_openUTF8(expected: %d chars)\n", file, line, u_errorName(status), strlen(expected)… in assertUText()
280 UErrorCode status = U_ZERO_ERROR; in assertUTextInvariant() local
282 regextst_openUTF8FromInvariant(&expectedText, expected, -1, &status); in assertUTextInvariant()
283 if(U_FAILURE(status)) { in assertUTextInvariant()
284 …st_openUTF8FromInvariant(expected: %d chars)\n", file, line, u_errorName(status), strlen(expected)… in assertUTextInvariant()
321 …t* regextst_openUTF8FromInvariant(UText *ut, const char *inv, int64_t length, UErrorCode *status) { in regextst_openUTF8FromInvariant() argument
325 return utext_openUTF8(ut, inv, length, status); in regextst_openUTF8FromInvariant()
330 *status = U_MEMORY_ALLOCATION_ERROR; in regextst_openUTF8FromInvariant()
342 return utext_openUTF8(ut, (const char*)buf, length, status); in regextst_openUTF8FromInvariant()
369 UErrorCode status = U_ZERO_ERROR; in doRegexLMTest() local
376 REPattern = RegexPattern::compile(patString, 0, pe, status); in doRegexLMTest()
377 if (U_FAILURE(status)) { in doRegexLMTest()
379 line, u_errorName(status)); in doRegexLMTest()
386 REMatcher = REPattern->matcher(unEscapedInput, status); in doRegexLMTest()
387 if (U_FAILURE(status)) { in doRegexLMTest()
389 line, u_errorName(status)); in doRegexLMTest()
394 actualmatch = REMatcher->lookingAt(status); in doRegexLMTest()
395 if (U_FAILURE(status)) { in doRegexLMTest()
397 line, u_errorName(status)); in doRegexLMTest()
405 status = U_ZERO_ERROR; in doRegexLMTest()
406 actualmatch = REMatcher->matches(status); in doRegexLMTest()
407 if (U_FAILURE(status)) { in doRegexLMTest()
409 line, u_errorName(status)); in doRegexLMTest()
432 UErrorCode status = U_ZERO_ERROR; in doRegexLMTestUTF8() local
438 regextst_openUTF8FromInvariant(&pattern, pat, -1, &status); in doRegexLMTestUTF8()
439 REPattern = RegexPattern::compile(&pattern, 0, pe, status); in doRegexLMTestUTF8()
440 if (U_FAILURE(status)) { in doRegexLMTestUTF8()
442 line, u_errorName(status)); in doRegexLMTestUTF8()
448 LocalUConverterPointer UTF8Converter(ucnv_open("UTF8", &status)); in doRegexLMTestUTF8()
449 …v_setFromUCallBack(UTF8Converter.getAlias(), UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status); in doRegexLMTestUTF8()
451 inputUTF8Length = unEscapedInput.extract(NULL, 0, UTF8Converter.getAlias(), status); in doRegexLMTestUTF8()
452 if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) { in doRegexLMTestUTF8()
454 …"RegexTest unable to convert input to UTF8 at line %d. Status = %s\n", line, u_errorName(status)); in doRegexLMTestUTF8()
457 status = U_ZERO_ERROR; // buffer overflow in doRegexLMTestUTF8()
459 unEscapedInput.extract(textChars, inputUTF8Length+1, UTF8Converter.getAlias(), status); in doRegexLMTestUTF8()
460 utext_openUTF8(&inputText, textChars, inputUTF8Length, &status); in doRegexLMTestUTF8()
462 REMatcher = &REPattern->matcher(status)->reset(&inputText); in doRegexLMTestUTF8()
463 if (U_FAILURE(status)) { in doRegexLMTestUTF8()
465 line, u_errorName(status)); in doRegexLMTestUTF8()
470 actualmatch = REMatcher->lookingAt(status); in doRegexLMTestUTF8()
471 if (U_FAILURE(status)) { in doRegexLMTestUTF8()
473 line, u_errorName(status)); in doRegexLMTestUTF8()
481 status = U_ZERO_ERROR; in doRegexLMTestUTF8()
482 actualmatch = REMatcher->matches(status); in doRegexLMTestUTF8()
483 if (U_FAILURE(status)) { in doRegexLMTestUTF8()
485 line, u_errorName(status)); in doRegexLMTestUTF8()
516 #define REGEX_ERR(pat, line, col, status) regex_err(pat, line, col, status, __LINE__) argument
522 UErrorCode status = U_ZERO_ERROR; in regex_err() local
530 callerPattern = RegexPattern::compile(patString, 0, pe, status); in regex_err()
531 if (status != expectedStatus) { in regex_err()
532 dataerrln("Line %d: unexpected error %s compiling pattern.", line, u_errorName(status)); in regex_err()
534 if (status != U_ZERO_ERROR) { in regex_err()
548 regextst_openUTF8FromInvariant(&patternText, pat, -1, &status); in regex_err()
549 callerPattern = RegexPattern::compile(&patternText, 0, pe, status); in regex_err()
550 if (status != expectedStatus) { in regex_err()
551 dataerrln("Line %d: unexpected error %s compiling pattern.", line, u_errorName(status)); in regex_err()
553 if (status != U_ZERO_ERROR) { in regex_err()
584 UErrorCode status = U_ZERO_ERROR; in Basic()
586 …ttern::compile(UNICODE_STRING_SIMPLE("a\\u00dfx").unescape(), UREGEX_CASE_INSENSITIVE, pe, status); in Basic()
588 … RegexMatcher *m = pattern->matcher(UNICODE_STRING_SIMPLE("a\\u00dfxzzz").unescape(), status); in Basic()
730 UErrorCode status = U_ZERO_ERROR; in UTextBasic() local
732 utext_openUTF8(&pattern, str_abc, -1, &status); in UTextBasic()
733 RegexMatcher matcher(&pattern, 0, status); in UTextBasic()
737 utext_openUTF8(&input, str_abc, -1, &status); in UTextBasic()
761 UErrorCode status=U_ZERO_ERROR; in API_Match() local
779 pat2 = RegexPattern::compile(re, flags, pe, status); in API_Match()
790 RegexMatcher *m1 = pat2->matcher(inStr1, status); in API_Match()
792 REGEX_ASSERT(m1->lookingAt(status) == true); in API_Match()
795 REGEX_ASSERT(m1->lookingAt(status) == false); in API_Match()
799 REGEX_ASSERT(m1->lookingAt(status) == true); in API_Match()
801 REGEX_ASSERT(m1->lookingAt(status) == false); in API_Match()
809 m1->reset(4, status); in API_Match()
812 REGEX_ASSERT(m1->lookingAt(status) == true); in API_Match()
814 m1->reset(-1, status); in API_Match()
815 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
816 status = U_ZERO_ERROR; in API_Match()
818 m1->reset(0, status); in API_Match()
820 status = U_ZERO_ERROR; in API_Match()
823 m1->reset(len-1, status); in API_Match()
825 status = U_ZERO_ERROR; in API_Match()
827 m1->reset(len, status); in API_Match()
829 status = U_ZERO_ERROR; in API_Match()
831 m1->reset(len+1, status); in API_Match()
832 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
833 status = U_ZERO_ERROR; in API_Match()
839 REGEX_ASSERT(m1->matches(4, status) == true); in API_Match()
841 REGEX_ASSERT(m1->matches(3, status) == false); in API_Match()
843 REGEX_ASSERT(m1->matches(5, status) == false); in API_Match()
844 REGEX_ASSERT(m1->matches(4, status) == true); in API_Match()
845 REGEX_ASSERT(m1->matches(-1, status) == false); in API_Match()
846 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
850 status = U_ZERO_ERROR; in API_Match()
852 REGEX_ASSERT(m1->matches(len, status) == false); in API_Match()
856 status = U_ZERO_ERROR; in API_Match()
857 REGEX_ASSERT(m1->matches(len+1, status) == false); in API_Match()
858 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
862 status = U_ZERO_ERROR; in API_Match()
863 RegexMatcher m("A?", 0, status); // will match zero length string. in API_Match()
867 REGEX_ASSERT(m.matches(len, status) == true); in API_Match()
870 REGEX_ASSERT(m.matches(0, status) == true); in API_Match()
878 status = U_ZERO_ERROR; in API_Match()
880 REGEX_ASSERT(m1->lookingAt(4, status) == true); in API_Match()
881 REGEX_ASSERT(m1->lookingAt(5, status) == false); in API_Match()
882 REGEX_ASSERT(m1->lookingAt(3, status) == false); in API_Match()
883 REGEX_ASSERT(m1->lookingAt(4, status) == true); in API_Match()
884 REGEX_ASSERT(m1->lookingAt(-1, status) == false); in API_Match()
885 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
886 status = U_ZERO_ERROR; in API_Match()
888 REGEX_ASSERT(m1->lookingAt(len, status) == false); in API_Match()
890 REGEX_ASSERT(m1->lookingAt(len+1, status) == false); in API_Match()
891 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
907 UErrorCode status=U_ZERO_ERROR; in API_Match() local
910 RegexPattern *pat = RegexPattern::compile(re, flags, pe, status); in API_Match()
914 RegexMatcher *matcher = pat->matcher(data, status); in API_Match()
916 REGEX_ASSERT(matcher->lookingAt(status) == true); in API_Match()
921 int32_t actualStart = matcher->start(i, status); in API_Match()
927 int32_t actualEnd = matcher->end(i, status); in API_Match()
935 REGEX_ASSERT(matcher->start(0, status) == matcher->start(status)); in API_Match()
936 REGEX_ASSERT(matcher->end(0, status) == matcher->end(status)); in API_Match()
938 REGEX_ASSERT_FAIL(matcher->start(-1, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
939 REGEX_ASSERT_FAIL(matcher->start( 4, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
941 REGEX_ASSERT_FAIL(matcher->start( 0, status), U_REGEX_INVALID_STATE); in API_Match()
943 matcher->lookingAt(status); in API_Match()
944 REGEX_ASSERT(matcher->group(status) == "0123456789"); in API_Match()
945 REGEX_ASSERT(matcher->group(0, status) == "0123456789"); in API_Match()
946 REGEX_ASSERT(matcher->group(1, status) == "234567" ); in API_Match()
947 REGEX_ASSERT(matcher->group(2, status) == "45" ); in API_Match()
948 REGEX_ASSERT(matcher->group(3, status) == "89" ); in API_Match()
950 REGEX_ASSERT_FAIL(matcher->group(-1, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
951 REGEX_ASSERT_FAIL(matcher->group( 4, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
953 REGEX_ASSERT_FAIL(matcher->group( 0, status), U_REGEX_INVALID_STATE); in API_Match()
966 UErrorCode status=U_ZERO_ERROR; in API_Match() local
969 RegexPattern *pat = RegexPattern::compile(re, flags, pe, status); in API_Match()
974 RegexMatcher *matcher = pat->matcher(data, status); in API_Match()
977 REGEX_ASSERT(matcher->start(status) == 1); in API_Match()
979 REGEX_ASSERT(matcher->start(status) == 6); in API_Match()
981 REGEX_ASSERT(matcher->start(status) == 12); in API_Match()
987 REGEX_ASSERT(matcher->start(status) == 1); in API_Match()
989 REGEX_ASSERT(matcher->find(0, status)); in API_Match()
990 REGEX_ASSERT(matcher->start(status) == 1); in API_Match()
991 REGEX_ASSERT(matcher->find(1, status)); in API_Match()
992 REGEX_ASSERT(matcher->start(status) == 1); in API_Match()
993 REGEX_ASSERT(matcher->find(2, status)); in API_Match()
994 REGEX_ASSERT(matcher->start(status) == 6); in API_Match()
995 REGEX_ASSERT(matcher->find(12, status)); in API_Match()
996 REGEX_ASSERT(matcher->start(status) == 12); in API_Match()
997 REGEX_ASSERT(matcher->find(13, status) == false); in API_Match()
998 REGEX_ASSERT(matcher->find(16, status) == false); in API_Match()
999 REGEX_ASSERT(matcher->find(17, status) == false); in API_Match()
1000 REGEX_ASSERT_FAIL(matcher->start(status), U_REGEX_INVALID_STATE); in API_Match()
1002 status = U_ZERO_ERROR; in API_Match()
1003 REGEX_ASSERT_FAIL(matcher->find(-1, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
1004 status = U_ZERO_ERROR; in API_Match()
1005 REGEX_ASSERT_FAIL(matcher->find(18, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match()
1020 UErrorCode status=U_ZERO_ERROR; in API_Match() local
1023 RegexPattern *pat = RegexPattern::compile(re, flags, pe, status); in API_Match()
1028 RegexMatcher *matcher = pat->matcher(data, status); in API_Match()
1031 REGEX_ASSERT(matcher->start(status) == 0); in API_Match()
1032 REGEX_ASSERT(matcher->start(1, status) == -1); in API_Match()
1033 REGEX_ASSERT(matcher->start(2, status) == 1); in API_Match()
1036 REGEX_ASSERT(matcher->start(status) == 4); in API_Match()
1037 REGEX_ASSERT(matcher->start(1, status) == 4); in API_Match()
1038 REGEX_ASSERT(matcher->start(2, status) == -1); in API_Match()
1051 UErrorCode status=U_ZERO_ERROR; in API_Match() local
1052 … RegexMatcher m("(?= ?)", 0, status); // This pattern will zero-length matches anywhere, in API_Match()
1061 REGEX_ASSERT(m.start(status) == i); in API_Match()
1062 REGEX_ASSERT(m.end(status) == i); in API_Match()
1074 REGEX_ASSERT(m.start(status) == i); in API_Match()
1075 REGEX_ASSERT(m.end(status) == i); in API_Match()
1084 UErrorCode status=U_ZERO_ERROR; in API_Match() local
1085 RegexMatcher m(".?", 0, status); in API_Match()
1093 REGEX_ASSERT(m.start(status) == i); in API_Match()
1094 REGEX_ASSERT(m.end(status) == (i<4 ? i+1 : i)); in API_Match()
1105 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1106 RegexMatcher m(".?", 0, status); in API_Match()
1109 REGEX_ASSERT(m.start(status) == 0); in API_Match()
1113 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1114 RegexPattern *p = RegexPattern::compile(".", 0, status); in API_Match()
1115 RegexMatcher *m = p->matcher(status); in API_Match()
1128 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1130 RegexMatcher m(".*", testString, 0, status); in API_Match()
1137 m.region(2,4, status); in API_Match()
1139 REGEX_ASSERT(m.matches(status)); in API_Match()
1140 REGEX_ASSERT(m.start(status)==2); in API_Match()
1141 REGEX_ASSERT(m.end(status)==4); in API_Match()
1181 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1183 RegexMatcher m1(".*", testString, 0, status); in API_Match()
1184 REGEX_ASSERT(m1.lookingAt(status) == true); in API_Match()
1189 status = U_ZERO_ERROR; in API_Match()
1190 RegexMatcher m2("a*", testString, 0, status); in API_Match()
1191 REGEX_ASSERT(m2.lookingAt(status) == true); in API_Match()
1196 status = U_ZERO_ERROR; in API_Match()
1197 RegexMatcher m3(".*$", testString, 0, status); in API_Match()
1198 REGEX_ASSERT(m3.lookingAt(status) == true); in API_Match()
1213 UErrorCode status = U_ZERO_ERROR; in API_Match()
1215 RegexMatcher m(".", 0, status); in API_Match()
1218 RegexPattern *p = RegexPattern::compile(".", 0, status); in API_Match()
1219 RegexMatcher *m2 = p->matcher(ucharString, status); // should not compile. in API_Match()
1221 RegexMatcher m3(".", ucharString, 0, status); // Should not compile in API_Match()
1232 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1236 RegexMatcher matcher("(a+)+b", testString, 0, status); in API_Match()
1239 matcher.setTimeLimit(100, status); in API_Match()
1241 REGEX_ASSERT(matcher.lookingAt(status) == false); in API_Match()
1242 REGEX_ASSERT(status == U_REGEX_TIME_OUT); in API_Match()
1245 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1248 RegexMatcher matcher("(a+)+b", testString, 0, status); in API_Match()
1250 matcher.setTimeLimit(100, status); in API_Match()
1251 REGEX_ASSERT(matcher.lookingAt(status) == false); in API_Match()
1259 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1264 RegexMatcher matcher("(A)+A$", testString, 0, status); in API_Match()
1267 REGEX_ASSERT(matcher.lookingAt(status) == false); in API_Match()
1268 REGEX_ASSERT(status == U_REGEX_STACK_OVERFLOW); in API_Match()
1271 status = U_ZERO_ERROR; in API_Match()
1272 matcher.setStackLimit(0, status); in API_Match()
1274 REGEX_ASSERT(matcher.lookingAt(status) == true); in API_Match()
1279 status = U_ZERO_ERROR; in API_Match()
1280 matcher.setStackLimit(10000, status); in API_Match()
1281 REGEX_ASSERT(matcher.lookingAt(status) == false); in API_Match()
1282 REGEX_ASSERT(status == U_REGEX_STACK_OVERFLOW); in API_Match()
1289 UErrorCode status = U_ZERO_ERROR; in API_Match() local
1291 RegexMatcher matcher("abc", testString, 0, status); in API_Match()
1293 matcher.setStackLimit(30, status); in API_Match()
1295 REGEX_ASSERT(matcher.matches(status) == true); in API_Match()
1300 status = U_ZERO_ERROR; in API_Match()
1301 matcher.setStackLimit(1000, status); in API_Match()
1303 matcher.setStackLimit(-1, status); in API_Match()
1304 REGEX_ASSERT(status == U_ILLEGAL_ARGUMENT_ERROR); in API_Match()
1328 UErrorCode status=U_ZERO_ERROR; in API_Replace() local
1331 RegexPattern *pat = RegexPattern::compile(re, flags, pe, status); in API_Replace()
1335 RegexMatcher *matcher = pat->matcher(data, status); in API_Replace()
1341 dest = matcher->replaceFirst("yz", status); in API_Replace()
1345 dest = matcher->replaceAll("yz", status); in API_Replace()
1354 dest = matcher->replaceFirst("yz", status); in API_Replace()
1358 dest = matcher->replaceAll("yz", status); in API_Replace()
1367 dest = matcher->replaceFirst("yz", status); in API_Replace()
1371 dest = matcher->replaceAll("yz", status); in API_Replace()
1379 dest = matcher->replaceFirst("", status); in API_Replace()
1383 dest = matcher->replaceAll("", status); in API_Replace()
1392 dest = matcher->replaceFirst("xyz", status); in API_Replace()
1396 dest = matcher->replaceAll("xyz", status); in API_Replace()
1404 RegexPattern *pat2 = RegexPattern::compile(re2, flags, pe, status); in API_Replace()
1407 RegexMatcher *matcher2 = pat2->matcher(d5, status); in API_Replace()
1409 dest = matcher2->replaceFirst("$1$1", status); in API_Replace()
1413 dest = matcher2->replaceFirst(UNICODE_STRING_SIMPLE("The value of \\$1 is $1."), status); in API_Replace()
1417 dest = matcher2->replaceFirst("$ by itself, no group number $$$", status); in API_Replace()
1418 REGEX_ASSERT(U_FAILURE(status)); in API_Replace()
1419 status = U_ZERO_ERROR; in API_Replace()
1423 dest = matcher2->replaceFirst(replacement, status); in API_Replace()
1427 …REGEX_ASSERT_FAIL(matcher2->replaceFirst("bad capture group number $5...",status), U_INDEX_OUTOFBO… in API_Replace()
1437 UnicodeString result = matcher->replaceAll(substitute, status); in API_Replace()
1445 UnicodeString result = matcher->replaceAll(substitute, status); in API_Replace()
1457 status = U_ZERO_ERROR; in API_Replace()
1459 RegexMatcher m("ss(.*?)ee", 0, status); in API_Replace()
1467 m.appendReplacement(result, "ooh", status); in API_Replace()
1472 status = U_ZERO_ERROR; in API_Replace()
1474 m.reset(10, status); in API_Replace()
1477 m.appendReplacement(result, "ooh", status); in API_Replace()
1482 status = U_ZERO_ERROR; in API_Replace()
1485 m.find(10, status); in API_Replace()
1487 m.appendReplacement(result, "ooh", status); in API_Replace()
1518 UErrorCode status = U_ZERO_ERROR; in API_Pattern() local
1521 RegexPattern *pat1 = RegexPattern::compile(re1, 0, pe, status); in API_Pattern()
1522 RegexPattern *pat2 = RegexPattern::compile(re2, 0, pe, status); in API_Pattern()
1541 RegexPattern *pat1a = RegexPattern::compile(re1, pe, status); in API_Pattern()
1547 RegexPattern *pat1b = RegexPattern::compile(re1, UREGEX_CASE_INSENSITIVE, pe, status); in API_Pattern()
1571 UErrorCode status = U_ZERO_ERROR; in API_Pattern() local
1572 … RegexPattern *pSource = RegexPattern::compile(UNICODE_STRING_SIMPLE("\\p{L}+"), 0, status); in API_Pattern()
1575 RegexMatcher *mFromClone = pClone->matcher(status); in API_Pattern()
1580 REGEX_ASSERT(mFromClone->group(status) == "Hello"); in API_Pattern()
1582 REGEX_ASSERT(mFromClone->group(status) == "World"); in API_Pattern()
1591 REGEX_ASSERT(RegexPattern::matches(".*", "random input", pe, status) == true); in API_Pattern()
1593 REGEX_ASSERT(RegexPattern::matches("abc", "random input", pe, status) == false); in API_Pattern()
1595 REGEX_ASSERT(RegexPattern::matches(".*nput", "random input", pe, status) == true); in API_Pattern()
1597 REGEX_ASSERT(RegexPattern::matches("random input", "random input", pe, status) == true); in API_Pattern()
1599 REGEX_ASSERT(RegexPattern::matches(".*u", "random input", pe, status) == false); in API_Pattern()
1601 status = U_INDEX_OUTOFBOUNDS_ERROR; in API_Pattern()
1602 REGEX_ASSERT(RegexPattern::matches("abc", "abc", pe, status) == false); in API_Pattern()
1603 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Pattern()
1609 status = U_ZERO_ERROR; in API_Pattern()
1610 pat1 = RegexPattern::compile(" +", pe, status); in API_Pattern()
1615 n = pat1->split("Now is the time", fields, 10, status); in API_Pattern()
1624 n = pat1->split("Now is the time", fields, 2, status); in API_Pattern()
1632 status = U_ZERO_ERROR; in API_Pattern()
1633 n = pat1->split("Now is the time", fields, 1, status); in API_Pattern()
1638 status = U_ZERO_ERROR; in API_Pattern()
1640 n = pat1->split(" Now is the time ", fields, 10, status); in API_Pattern()
1650 n = pat1->split(" ", fields, 10, status); in API_Pattern()
1657 n = pat1->split("", fields, 10, status); in API_Pattern()
1665 pat1 = RegexPattern::compile(UNICODE_STRING_SIMPLE("<(\\w*)>"), pe, status); in API_Pattern()
1668 status = U_ZERO_ERROR; in API_Pattern()
1669 n = pat1->split("<a>Now is <b>the time<c>", fields, 10, status); in API_Pattern()
1679 REGEX_ASSERT(status==U_ZERO_ERROR); in API_Pattern()
1681 n = pat1->split(" <a>Now is <b>the time<c>", fields, 10, status); in API_Pattern()
1692 status = U_ZERO_ERROR; in API_Pattern()
1694 n = pat1->split(" <a>Now is <b>the time<c>", fields, 6, status); in API_Pattern()
1705 status = U_ZERO_ERROR; in API_Pattern()
1707 n = pat1->split(" <a>Now is <b>the time<c>", fields, 5, status); in API_Pattern()
1717 status = U_ZERO_ERROR; in API_Pattern()
1719 n = pat1->split(" <a>Now is <b>the time", fields, 5, status); in API_Pattern()
1729 status = U_ZERO_ERROR; in API_Pattern()
1730 n = pat1->split(" <a>Now is <b>the time<c>", fields, 4, status); in API_Pattern()
1737 status = U_ZERO_ERROR; in API_Pattern()
1740 pat1 = RegexPattern::compile("([-,])", pe, status); in API_Pattern()
1742 n = pat1->split("1-10,20", fields, 10, status); in API_Pattern()
1753 pat1 = RegexPattern::compile(",", pe, status); in API_Pattern()
1755 n = pat1->split("a,b,c,", fields, 10, status); in API_Pattern()
1763 n = pat1->split("a,,,", fields, 10, status); in API_Pattern()
1773 pat1 = RegexPattern::compile(":?", pe, status); in API_Pattern()
1775 n = pat1->split("abc", fields, 10, status); in API_Pattern()
1793 pat1 = RegexPattern::compile("(Hello, world)*", pe, status); in API_Pattern()
1802 pat1 = RegexPattern::compile("(Hello, world)*", pe, status); in API_Pattern()
1807 RegexMatcher *m = pat1->matcher(Hello, status); in API_Pattern()
1825 UErrorCode status=U_ZERO_ERROR; in API_Match_UTF8() local
1842 regextst_openUTF8FromInvariant(&re, "abc", -1, &status); in API_Match_UTF8()
1845 pat2 = RegexPattern::compile(&re, flags, pe, status); in API_Match_UTF8()
1851 regextst_openUTF8FromInvariant(&input1, "abcdef this is a test", -1, &status); in API_Match_UTF8()
1853 regextst_openUTF8FromInvariant(&input2, "not abc", -1, &status); in API_Match_UTF8()
1855 utext_openUChars(&empty, NULL, 0, &status); in API_Match_UTF8()
1864 RegexMatcher *m1 = &pat2->matcher(status)->reset(&input1); in API_Match_UTF8()
1866 REGEX_ASSERT(m1->lookingAt(status) == true); in API_Match_UTF8()
1870 REGEX_ASSERT(m1->lookingAt(status) == false); in API_Match_UTF8()
1875 REGEX_ASSERT(m1->lookingAt(status) == true); in API_Match_UTF8()
1877 REGEX_ASSERT(m1->lookingAt(status) == false); in API_Match_UTF8()
1884 m1->reset(4, status); in API_Match_UTF8()
1887 REGEX_ASSERT(m1->lookingAt(status) == true); in API_Match_UTF8()
1889 m1->reset(-1, status); in API_Match_UTF8()
1890 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
1891 status = U_ZERO_ERROR; in API_Match_UTF8()
1893 m1->reset(0, status); in API_Match_UTF8()
1895 status = U_ZERO_ERROR; in API_Match_UTF8()
1897 m1->reset(input1Len-1, status); in API_Match_UTF8()
1899 status = U_ZERO_ERROR; in API_Match_UTF8()
1901 m1->reset(input1Len, status); in API_Match_UTF8()
1903 status = U_ZERO_ERROR; in API_Match_UTF8()
1905 m1->reset(input1Len+1, status); in API_Match_UTF8()
1906 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
1907 status = U_ZERO_ERROR; in API_Match_UTF8()
1913 REGEX_ASSERT(m1->matches(4, status) == true); in API_Match_UTF8()
1915 REGEX_ASSERT(m1->matches(3, status) == false); in API_Match_UTF8()
1917 REGEX_ASSERT(m1->matches(5, status) == false); in API_Match_UTF8()
1918 REGEX_ASSERT(m1->matches(4, status) == true); in API_Match_UTF8()
1919 REGEX_ASSERT(m1->matches(-1, status) == false); in API_Match_UTF8()
1920 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
1924 status = U_ZERO_ERROR; in API_Match_UTF8()
1925 REGEX_ASSERT(m1->matches(input2Len, status) == false); in API_Match_UTF8()
1929 status = U_ZERO_ERROR; in API_Match_UTF8()
1930 REGEX_ASSERT(m1->matches(input2Len+1, status) == false); in API_Match_UTF8()
1931 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
1935 status = U_ZERO_ERROR; in API_Match_UTF8()
1936 RegexMatcher m("A?", 0, status); // will match zero length string. in API_Match_UTF8()
1939 REGEX_ASSERT(m.matches(input1Len, status) == true); in API_Match_UTF8()
1942 REGEX_ASSERT(m.matches(0, status) == true); in API_Match_UTF8()
1950 status = U_ZERO_ERROR; in API_Match_UTF8()
1952 REGEX_ASSERT(m1->lookingAt(4, status) == true); in API_Match_UTF8()
1953 REGEX_ASSERT(m1->lookingAt(5, status) == false); in API_Match_UTF8()
1954 REGEX_ASSERT(m1->lookingAt(3, status) == false); in API_Match_UTF8()
1955 REGEX_ASSERT(m1->lookingAt(4, status) == true); in API_Match_UTF8()
1956 REGEX_ASSERT(m1->lookingAt(-1, status) == false); in API_Match_UTF8()
1957 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
1958 status = U_ZERO_ERROR; in API_Match_UTF8()
1959 REGEX_ASSERT(m1->lookingAt(input2Len, status) == false); in API_Match_UTF8()
1961 REGEX_ASSERT(m1->lookingAt(input2Len+1, status) == false); in API_Match_UTF8()
1962 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
1983 UErrorCode status=U_ZERO_ERROR; in API_Match_UTF8() local
1986 utext_openUTF8(&re, str_01234567_pat, -1, &status); in API_Match_UTF8()
1988 RegexPattern *pat = RegexPattern::compile(&re, flags, pe, status); in API_Match_UTF8()
1993 utext_openUTF8(&input, str_0123456789, -1, &status); in API_Match_UTF8()
1995 RegexMatcher *matcher = &pat->matcher(status)->reset(&input); in API_Match_UTF8()
1997 REGEX_ASSERT(matcher->lookingAt(status) == true); in API_Match_UTF8()
2002 int32_t actualStart = matcher->start(i, status); in API_Match_UTF8()
2008 int32_t actualEnd = matcher->end(i, status); in API_Match_UTF8()
2016 REGEX_ASSERT(matcher->start(0, status) == matcher->start(status)); in API_Match_UTF8()
2017 REGEX_ASSERT(matcher->end(0, status) == matcher->end(status)); in API_Match_UTF8()
2019 REGEX_ASSERT_FAIL(matcher->start(-1, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
2020 REGEX_ASSERT_FAIL(matcher->start( 4, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
2022 REGEX_ASSERT_FAIL(matcher->start( 0, status), U_REGEX_INVALID_STATE); in API_Match_UTF8()
2024 matcher->lookingAt(status); in API_Match_UTF8()
2028 utext_openUnicodeString(&destText, &dest, &status); in API_Match_UTF8()
2033 result = matcher->group((UText *)NULL, group_len, status); in API_Match_UTF8()
2037 result = matcher->group(0, &destText, group_len, status); in API_Match_UTF8()
2043 utext_openUnicodeString(&destText, &dest, &status); in API_Match_UTF8()
2046 result = matcher->group(0, NULL, length, status); in API_Match_UTF8()
2050 result = matcher->group(0, &destText, length, status); in API_Match_UTF8()
2058 result = matcher->group(1, NULL, length, status); in API_Match_UTF8()
2065 result = matcher->group(1, &destText, length, status); in API_Match_UTF8()
2074 result = matcher->group(2, NULL, length, status); in API_Match_UTF8()
2081 result = matcher->group(2, &destText, length, status); in API_Match_UTF8()
2090 result = matcher->group(3, NULL, length, status); in API_Match_UTF8()
2097 result = matcher->group(3, &destText, length, status); in API_Match_UTF8()
2106 status = U_ZERO_ERROR; in API_Match_UTF8()
2107 REGEX_ASSERT_FAIL(matcher->group(-1, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
2108 status = U_ZERO_ERROR; in API_Match_UTF8()
2109 REGEX_ASSERT_FAIL(matcher->group( 4, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
2110 status = U_ZERO_ERROR; in API_Match_UTF8()
2112 REGEX_ASSERT_FAIL(matcher->group( 0, status), U_REGEX_INVALID_STATE); in API_Match_UTF8()
2128 UErrorCode status=U_ZERO_ERROR; in API_Match_UTF8() local
2131 utext_openUTF8(&re, str_abc, -1, &status); in API_Match_UTF8()
2133 RegexPattern *pat = RegexPattern::compile(&re, flags, pe, status); in API_Match_UTF8()
2137 utext_openUTF8(&input, str_abcabcabc, -1, &status); in API_Match_UTF8()
2140 RegexMatcher *matcher = &pat->matcher(status)->reset(&input); in API_Match_UTF8()
2143 REGEX_ASSERT(matcher->start(status) == 1); in API_Match_UTF8()
2145 REGEX_ASSERT(matcher->start(status) == 6); in API_Match_UTF8()
2147 REGEX_ASSERT(matcher->start(status) == 12); in API_Match_UTF8()
2153 REGEX_ASSERT(matcher->start(status) == 1); in API_Match_UTF8()
2155 REGEX_ASSERT(matcher->find(0, status)); in API_Match_UTF8()
2156 REGEX_ASSERT(matcher->start(status) == 1); in API_Match_UTF8()
2157 REGEX_ASSERT(matcher->find(1, status)); in API_Match_UTF8()
2158 REGEX_ASSERT(matcher->start(status) == 1); in API_Match_UTF8()
2159 REGEX_ASSERT(matcher->find(2, status)); in API_Match_UTF8()
2160 REGEX_ASSERT(matcher->start(status) == 6); in API_Match_UTF8()
2161 REGEX_ASSERT(matcher->find(12, status)); in API_Match_UTF8()
2162 REGEX_ASSERT(matcher->start(status) == 12); in API_Match_UTF8()
2163 REGEX_ASSERT(matcher->find(13, status) == false); in API_Match_UTF8()
2164 REGEX_ASSERT(matcher->find(16, status) == false); in API_Match_UTF8()
2165 REGEX_ASSERT(matcher->find(17, status) == false); in API_Match_UTF8()
2166 REGEX_ASSERT_FAIL(matcher->start(status), U_REGEX_INVALID_STATE); in API_Match_UTF8()
2168 status = U_ZERO_ERROR; in API_Match_UTF8()
2169 REGEX_ASSERT_FAIL(matcher->find(-1, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
2170 status = U_ZERO_ERROR; in API_Match_UTF8()
2171 REGEX_ASSERT_FAIL(matcher->find(18, status), U_INDEX_OUTOFBOUNDS_ERROR); in API_Match_UTF8()
2189 UErrorCode status=U_ZERO_ERROR; in API_Match_UTF8() local
2192 utext_openUTF8(&re, str_Gabcabc, -1, &status); in API_Match_UTF8()
2194 RegexPattern *pat = RegexPattern::compile(&re, flags, pe, status); in API_Match_UTF8()
2199 utext_openUTF8(&input, str_abcabcabc, -1, &status); in API_Match_UTF8()
2202 RegexMatcher *matcher = &pat->matcher(status)->reset(&input); in API_Match_UTF8()
2205 REGEX_ASSERT(matcher->start(status) == 0); in API_Match_UTF8()
2206 REGEX_ASSERT(matcher->start(1, status) == -1); in API_Match_UTF8()
2207 REGEX_ASSERT(matcher->start(2, status) == 1); in API_Match_UTF8()
2210 REGEX_ASSERT(matcher->start(status) == 4); in API_Match_UTF8()
2211 REGEX_ASSERT(matcher->start(1, status) == 4); in API_Match_UTF8()
2212 REGEX_ASSERT(matcher->start(2, status) == -1); in API_Match_UTF8()
2228 UErrorCode status=U_ZERO_ERROR; in API_Match_UTF8() local
2229 … RegexMatcher m("(?= ?)", 0, status); // This pattern will zero-length matches anywhere, in API_Match_UTF8()
2233 utext_openUTF8(&s, " ", -1, &status); in API_Match_UTF8()
2239 REGEX_ASSERT(m.start(status) == i); in API_Match_UTF8()
2240 REGEX_ASSERT(m.end(status) == i); in API_Match_UTF8()
2247 utext_openUTF8(&s, (char *)aboveBMP, -1, &status); in API_Match_UTF8()
2253 REGEX_ASSERT(m.start(status) == i); in API_Match_UTF8()
2254 REGEX_ASSERT(m.end(status) == i); in API_Match_UTF8()
2265 UErrorCode status=U_ZERO_ERROR; in API_Match_UTF8() local
2266 RegexMatcher m(".?", 0, status); in API_Match_UTF8()
2269 utext_openUTF8(&s, " ", -1, &status); in API_Match_UTF8()
2275 REGEX_ASSERT(m.start(status) == i); in API_Match_UTF8()
2276 REGEX_ASSERT(m.end(status) == (i<4 ? i+1 : i)); in API_Match_UTF8()
2289 UErrorCode status = U_ZERO_ERROR; in API_Match_UTF8() local
2290 RegexMatcher m(".?", 0, status); in API_Match_UTF8()
2293 REGEX_ASSERT(m.start(status) == 0); in API_Match_UTF8()
2297 UErrorCode status = U_ZERO_ERROR; in API_Match_UTF8() local
2298 RegexPattern *p = RegexPattern::compile(".", 0, status); in API_Match_UTF8()
2299 RegexMatcher *m = p->matcher(status); in API_Match_UTF8()
2312 UErrorCode status = U_ZERO_ERROR; in API_Match_UTF8() local
2315 regextst_openUTF8FromInvariant(&testPattern, ".*", -1, &status); in API_Match_UTF8()
2317 regextst_openUTF8FromInvariant(&testText, "This is test data", -1, &status); in API_Match_UTF8()
2320 RegexMatcher m(&testPattern, &testText, 0, status); in API_Match_UTF8()
2327 m.region(2,4, status); in API_Match_UTF8()
2329 REGEX_ASSERT(m.matches(status)); in API_Match_UTF8()
2330 REGEX_ASSERT(m.start(status)==2); in API_Match_UTF8()
2331 REGEX_ASSERT(m.end(status)==4); in API_Match_UTF8()
2338 regextst_openUTF8FromInvariant(&testText, "short", -1, &status); in API_Match_UTF8()
2374 UErrorCode status = U_ZERO_ERROR; in API_Match_UTF8() local
2379 utext_openUTF8(&testPattern, str_, -1, &status); in API_Match_UTF8()
2380 utext_openUTF8(&testText, str_aabb, -1, &status); in API_Match_UTF8()
2382 RegexMatcher m1(&testPattern, &testText, 0, status); in API_Match_UTF8()
2383 REGEX_ASSERT(m1.lookingAt(status) == true); in API_Match_UTF8()
2388 status = U_ZERO_ERROR; in API_Match_UTF8()
2390 utext_openUTF8(&testPattern, str_a, -1, &status); in API_Match_UTF8()
2391 RegexMatcher m2(&testPattern, &testText, 0, status); in API_Match_UTF8()
2392 REGEX_ASSERT(m2.lookingAt(status) == true); in API_Match_UTF8()
2397 status = U_ZERO_ERROR; in API_Match_UTF8()
2399 utext_openUTF8(&testPattern, str_dotstardollar, -1, &status); in API_Match_UTF8()
2400 RegexMatcher m3(&testPattern, &testText, 0, status); in API_Match_UTF8()
2401 REGEX_ASSERT(m3.lookingAt(status) == true); in API_Match_UTF8()
2424 UErrorCode status=U_ZERO_ERROR; in API_Replace_UTF8() local
2427 regextst_openUTF8FromInvariant(&re, "abc", -1, &status); in API_Replace_UTF8()
2429 RegexPattern *pat = RegexPattern::compile(&re, flags, pe, status); in API_Replace_UTF8()
2435 utext_openUTF8(&dataText, data, -1, &status); in API_Replace_UTF8()
2438 RegexMatcher *matcher = &pat->matcher(status)->reset(&dataText); in API_Replace_UTF8()
2445 utext_openUnicodeString(&destText, &dest, &status); in API_Replace_UTF8()
2451 utext_openUTF8(&replText, str_yz, -1, &status); in API_Replace_UTF8()
2453 result = matcher->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2458 result = matcher->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2463 result = matcher->replaceAll(&replText, NULL, status); in API_Replace_UTF8()
2469 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2470 result = matcher->replaceAll(&replText, &destText, status); in API_Replace_UTF8()
2479 utext_openUTF8(&dataText, str_abxabxabx, -1, &status); in API_Replace_UTF8()
2482 result = matcher->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2486 result = matcher->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2491 result = matcher->replaceAll(&replText, NULL, status); in API_Replace_UTF8()
2495 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2496 result = matcher->replaceAll(&replText, &destText, status); in API_Replace_UTF8()
2504 utext_openUTF8(&dataText, NULL, 0, &status); in API_Replace_UTF8()
2507 result = matcher->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2511 result = matcher->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2516 result = matcher->replaceAll(&replText, NULL, status); in API_Replace_UTF8()
2520 result = matcher->replaceAll(&replText, &destText, status); in API_Replace_UTF8()
2528 utext_openUTF8(&dataText, data, -1, &status); // ".abc..abc...abc.." in API_Replace_UTF8()
2531 utext_openUTF8(&replText, NULL, 0, &status); in API_Replace_UTF8()
2532 result = matcher->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2537 result = matcher->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2542 result = matcher->replaceAll(&replText, NULL, status); in API_Replace_UTF8()
2547 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2548 result = matcher->replaceAll(&replText, &destText, status); in API_Replace_UTF8()
2557 utext_openUTF8(&dataText, str_abc, -1, &status); in API_Replace_UTF8()
2561 utext_openUTF8(&replText, str_xyz, -1, &status); in API_Replace_UTF8()
2562 result = matcher->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2566 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2567 result = matcher->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2572 result = matcher->replaceAll(&replText, NULL, status); in API_Replace_UTF8()
2576 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2577 result = matcher->replaceAll(&replText, &destText, status); in API_Replace_UTF8()
2586 utext_openUTF8(&re, str_add, -1, &status); in API_Replace_UTF8()
2587 RegexPattern *pat2 = RegexPattern::compile(&re, flags, pe, status); in API_Replace_UTF8()
2591 utext_openUTF8(&dataText, str_abcdefg, -1, &status); in API_Replace_UTF8()
2592 RegexMatcher *matcher2 = &pat2->matcher(status)->reset(&dataText); in API_Replace_UTF8()
2596 utext_openUTF8(&replText, str_11, -1, &status); in API_Replace_UTF8()
2597 result = matcher2->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2602 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2603 result = matcher2->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2609 utext_openUTF8(&replText, str_v, -1, &status); in API_Replace_UTF8()
2611 result = matcher2->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2616 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2617 result = matcher2->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2625 utext_openUTF8(&replText, str_byitselfnogroupnumber, -1, &status); in API_Replace_UTF8()
2626 result = matcher2->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2631 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2632 result = matcher2->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2644 utext_openUTF8(&replText, (char *)supplDigitChars, -1, &status); in API_Replace_UTF8()
2646 result = matcher2->replaceFirst(&replText, NULL, status); in API_Replace_UTF8()
2651 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2652 result = matcher2->replaceFirst(&replText, &destText, status); in API_Replace_UTF8()
2657 utext_openUTF8(&replText, str_badcapturegroupnumber5, -1, &status); in API_Replace_UTF8()
2658 …REGEX_ASSERT_FAIL((result = matcher2->replaceFirst(&replText, NULL, status)), U_INDEX_OUTOFBOUNDS_… in API_Replace_UTF8()
2661 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2662 …REGEX_ASSERT_FAIL((result = matcher2->replaceFirst(&replText, &destText, status)), U_INDEX_OUTOFBO… in API_Replace_UTF8()
2672 utext_openUTF8(&dataText, str_abc1abc2abc3, -1, &status); in API_Replace_UTF8()
2673 utext_openUTF8(&replText, str_u0043, -1, &status); in API_Replace_UTF8()
2676 result = matcher->replaceAll(&replText, NULL, status); in API_Replace_UTF8()
2681 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2682 result = matcher->replaceAll(&replText, &destText, status); in API_Replace_UTF8()
2689 utext_openUTF8(&dataText, str_abc, -1, &status); in API_Replace_UTF8()
2691 utext_openUTF8(&replText, str_U00010000, -1, &status); in API_Replace_UTF8()
2701 result = matcher->replaceAll(&replText, NULL, status); in API_Replace_UTF8()
2705 utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status); in API_Replace_UTF8()
2706 result = matcher->replaceAll(&replText, &destText, status); in API_Replace_UTF8()
2716 status = U_ZERO_ERROR; in API_Replace_UTF8()
2720 utext_openUTF8(&re, str_ssee, -1, &status); in API_Replace_UTF8()
2721 utext_openUTF8(&dataText, str_blah, -1, &status); in API_Replace_UTF8()
2722 utext_openUTF8(&replText, str_ooh, -1, &status); in API_Replace_UTF8()
2724 RegexMatcher m(&re, 0, status); in API_Replace_UTF8()
2729 utext_openUnicodeString(&resultText, &result, &status); in API_Replace_UTF8()
2735 m.appendReplacement(&resultText, &replText, status); in API_Replace_UTF8()
2741 status = U_ZERO_ERROR; in API_Replace_UTF8()
2743 utext_openUnicodeString(&resultText, &result, &status); in API_Replace_UTF8()
2744 m.reset(10, status); in API_Replace_UTF8()
2747 m.appendReplacement(&resultText, &replText, status); in API_Replace_UTF8()
2753 status = U_ZERO_ERROR; in API_Replace_UTF8()
2755 utext_openUnicodeString(&resultText, &result, &status); in API_Replace_UTF8()
2757 m.find(10, status); in API_Replace_UTF8()
2759 m.appendReplacement(&resultText, &replText, status); in API_Replace_UTF8()
2764 m.appendTail(&resultText, status); in API_Replace_UTF8()
2798 UErrorCode status = U_ZERO_ERROR; in API_Pattern_UTF8() local
2803 utext_openUTF8(&re1, str_abcalmz, -1, &status); in API_Pattern_UTF8()
2804 utext_openUTF8(&re2, str_def, -1, &status); in API_Pattern_UTF8()
2806 RegexPattern *pat1 = RegexPattern::compile(&re1, 0, pe, status); in API_Pattern_UTF8()
2807 RegexPattern *pat2 = RegexPattern::compile(&re2, 0, pe, status); in API_Pattern_UTF8()
2826 RegexPattern *pat1a = RegexPattern::compile(&re1, pe, status); in API_Pattern_UTF8()
2832 RegexPattern *pat1b = RegexPattern::compile(&re1, UREGEX_CASE_INSENSITIVE, pe, status); in API_Pattern_UTF8()
2859 UErrorCode status = U_ZERO_ERROR; in API_Pattern_UTF8() local
2862 utext_openUTF8(&pattern, str_pL, -1, &status); in API_Pattern_UTF8()
2864 RegexPattern *pSource = RegexPattern::compile(&pattern, 0, status); in API_Pattern_UTF8()
2867 RegexMatcher *mFromClone = pClone->matcher(status); in API_Pattern_UTF8()
2872 utext_openUTF8(&input, str_HelloWorld, -1, &status); in API_Pattern_UTF8()
2875 REGEX_ASSERT(mFromClone->group(status) == "Hello"); in API_Pattern_UTF8()
2877 REGEX_ASSERT(mFromClone->group(status) == "World"); in API_Pattern_UTF8()
2890 UErrorCode status = U_ZERO_ERROR; in API_Pattern_UTF8() local
2895 utext_openUTF8(&input, str_randominput, -1, &status); in API_Pattern_UTF8()
2898 utext_openUTF8(&pattern, str_dotstar, -1, &status); in API_Pattern_UTF8()
2899 REGEX_ASSERT(RegexPattern::matches(&pattern, &input, pe, status) == true); in API_Pattern_UTF8()
2903 utext_openUTF8(&pattern, str_abc, -1, &status); in API_Pattern_UTF8()
2904 REGEX_ASSERT(RegexPattern::matches("abc", "random input", pe, status) == false); in API_Pattern_UTF8()
2908 utext_openUTF8(&pattern, str_nput, -1, &status); in API_Pattern_UTF8()
2909 REGEX_ASSERT(RegexPattern::matches(".*nput", "random input", pe, status) == true); in API_Pattern_UTF8()
2912 utext_openUTF8(&pattern, str_randominput, -1, &status); in API_Pattern_UTF8()
2913 REGEX_ASSERT(RegexPattern::matches("random input", "random input", pe, status) == true); in API_Pattern_UTF8()
2917 utext_openUTF8(&pattern, str_u, -1, &status); in API_Pattern_UTF8()
2918 REGEX_ASSERT(RegexPattern::matches(".*u", "random input", pe, status) == false); in API_Pattern_UTF8()
2921 utext_openUTF8(&input, str_abc, -1, &status); in API_Pattern_UTF8()
2922 utext_openUTF8(&pattern, str_abc, -1, &status); in API_Pattern_UTF8()
2923 status = U_INDEX_OUTOFBOUNDS_ERROR; in API_Pattern_UTF8()
2924 REGEX_ASSERT(RegexPattern::matches("abc", "abc", pe, status) == false); in API_Pattern_UTF8()
2925 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in API_Pattern_UTF8()
2935 status = U_ZERO_ERROR; in API_Pattern_UTF8()
2937 utext_openUTF8(&re1, str_spaceplus, -1, &status); in API_Pattern_UTF8()
2938 pat1 = RegexPattern::compile(&re1, pe, status); in API_Pattern_UTF8()
2943 n = pat1->split("Now is the time", fields, 10, status); in API_Pattern_UTF8()
2952 n = pat1->split("Now is the time", fields, 2, status); in API_Pattern_UTF8()
2960 status = U_ZERO_ERROR; in API_Pattern_UTF8()
2961 n = pat1->split("Now is the time", fields, 1, status); in API_Pattern_UTF8()
2966 status = U_ZERO_ERROR; in API_Pattern_UTF8()
2968 n = pat1->split(" Now is the time ", fields, 10, status); in API_Pattern_UTF8()
2980 n = pat1->split(" ", fields, 10, status); in API_Pattern_UTF8()
2988 n = pat1->split("", fields, 10, status); in API_Pattern_UTF8()
2996 regextst_openUTF8FromInvariant(&re1, "<(\\w*)>", -1, &status); in API_Pattern_UTF8()
2997 pat1 = RegexPattern::compile(&re1, pe, status); in API_Pattern_UTF8()
3000 status = U_ZERO_ERROR; in API_Pattern_UTF8()
3002 n = pat1->split("<a>Now is <b>the time<c>", fields, 10, status); in API_Pattern_UTF8()
3013 REGEX_ASSERT(status==U_ZERO_ERROR); in API_Pattern_UTF8()
3016 n = pat1->split(" <a>Now is <b>the time<c>", fields, 10, status); in API_Pattern_UTF8()
3028 status = U_ZERO_ERROR; in API_Pattern_UTF8()
3030 n = pat1->split(" <a>Now is <b>the time<c> ", fields, 6, status); in API_Pattern_UTF8()
3041 status = U_ZERO_ERROR; in API_Pattern_UTF8()
3043 n = pat1->split(" <a>Now is <b>the time<c>", fields, 5, status); in API_Pattern_UTF8()
3053 status = U_ZERO_ERROR; in API_Pattern_UTF8()
3055 n = pat1->split(" <a>Now is <b>the time", fields, 5, status); in API_Pattern_UTF8()
3065 status = U_ZERO_ERROR; in API_Pattern_UTF8()
3066 n = pat1->split(" <a>Now is <b>the time<c>", fields, 4, status); in API_Pattern_UTF8()
3073 status = U_ZERO_ERROR; in API_Pattern_UTF8()
3076 regextst_openUTF8FromInvariant(&re1, "([-,])", -1, &status); in API_Pattern_UTF8()
3077 pat1 = RegexPattern::compile(&re1, pe, status); in API_Pattern_UTF8()
3079 n = pat1->split("1-10,20", fields, 10, status); in API_Pattern_UTF8()
3094 status = U_ZERO_ERROR; in API_Pattern_UTF8()
3095 RegexMatcher matcher(UnicodeString("(:)"), 0, status); in API_Pattern_UTF8()
3097 UText *textToSplit = utext_openUnicodeString(NULL, &stringToSplit, &status); in API_Pattern_UTF8()
3101 int32_t numFields = matcher.split(textToSplit, splits, UPRV_LENGTHOF(splits), status); in API_Pattern_UTF8()
3126 REGEX_ASSERT_UTEXT_UTF8("", pat1->patternText(status)); in API_Pattern_UTF8()
3129 regextst_openUTF8FromInvariant(&re1, helloWorldInvariant, -1, &status); in API_Pattern_UTF8()
3130 pat1 = RegexPattern::compile(&re1, pe, status); in API_Pattern_UTF8()
3133 REGEX_ASSERT_UTEXT_INVARIANT("(Hello, world)*", pat1->patternText(status)); in API_Pattern_UTF8()
3151 UErrorCode status=U_ZERO_ERROR; in getPath() local
3152 const char *testDataDirectory = IntlTest::getSourceTestData(status); in getPath()
3153 if (U_FAILURE(status)) { in getPath()
3154 errln("ERROR: loadTestData() failed - %s", u_errorName(status)); in getPath()
3166 UErrorCode status = U_ZERO_ERROR; in Extended() local
3178 UChar *testData = ReadAndConvertFile(srcPath, len, "utf-8", status); in Extended()
3179 if (U_FAILURE(status)) { in Extended()
3188 RegexMatcher quotedStuffMat(UNICODE_STRING_SIMPLE("\\s*([\\'\\\"/])(.*?)\\1"), 0, status); in Extended()
3189 RegexMatcher commentMat (UNICODE_STRING_SIMPLE("\\s*(#.*)?$"), 0, status); in Extended()
3190 …flagsMat (UNICODE_STRING_SIMPLE("\\s*([ixsmdteDEGLMQvabtyYzZ2-9]*)([:letter:]*)"), 0, status); in Extended()
3192 RegexMatcher lineMat(UNICODE_STRING_SIMPLE("(.*?)\\r?\\n"), testString, 0, status); in Extended()
3197 if (U_FAILURE(status)){ in Extended()
3198 dataerrln("Construct RegexMatcher() error - %s", u_errorName(status)); in Extended()
3208 if (U_FAILURE(status)) { in Extended()
3209 errln("%s:%d: ICU Error \"%s\"", srcPath, lineNum, u_errorName(status)); in Extended()
3212 status = U_ZERO_ERROR; in Extended()
3213 UnicodeString testLine = lineMat.group(1, status); in Extended()
3224 if (commentMat.lookingAt(status)) { in Extended()
3233 if (quotedStuffMat.lookingAt(status)) { in Extended()
3234 testPattern = quotedStuffMat.group(2, status); in Extended()
3235 testLine.remove(0, quotedStuffMat.end(0, status)); in Extended()
3246 flagsMat.lookingAt(status); // Will always match, possibly an empty string. in Extended()
3247 testFlags = flagsMat.group(1, status); in Extended()
3248 if (flagsMat.group(2, status).length() > 0) { in Extended()
3250 lineNum, flagsMat.group(2, status).charAt(0)); in Extended()
3253 testLine.remove(0, flagsMat.end(0, status)); in Extended()
3260 if (quotedStuffMat.lookingAt(status)) { in Extended()
3261 matchString = quotedStuffMat.group(2, status); in Extended()
3262 testLine.remove(0, quotedStuffMat.end(0, status)); in Extended()
3272 if (commentMat.lookingAt(status) == false) { in Extended()
3305 UErrorCode status=U_ZERO_ERROR; in set() local
3312 while (vec.size()<idx+1) {vec.addElement(-1, status);} in set()
3317 UErrorCode status=U_ZERO_ERROR; in setInt() local
3318 while (vec.size()<idx+1) {vec.addElement(-1, status);} in setInt()
3355 UErrorCode status = U_ZERO_ERROR; in regex_find() local
3361 UVector groupStarts(status); in regex_find()
3362 UVector groupEnds(status); in regex_find()
3363 UVector groupStartsUTF8(status); in regex_find()
3364 UVector groupEndsUTF8(status); in regex_find()
3405 callerPattern = RegexPattern::compile(pattern, bflags, pe, status); in regex_find()
3406 if (status != U_ZERO_ERROR) { in regex_find()
3410 if (flags.indexOf((UChar)0x76) >= 0 /*'v'*/ && status == U_UNSUPPORTED_ERROR) { in regex_find()
3417 logln("Pattern Compile returns \"%s\"", u_errorName(status)); in regex_find()
3422 dataerrln("Line %d: error %s compiling pattern.", line, u_errorName(status)); in regex_find()
3427 UTF8Converter = ucnv_open("UTF8", &status); in regex_find()
3428 ucnv_setFromUCallBack(UTF8Converter, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status); in regex_find()
3430 patternUTF8Length = pattern.extract(NULL, 0, UTF8Converter, status); in regex_find()
3431 status = U_ZERO_ERROR; // buffer overflow in regex_find()
3433 pattern.extract(patternChars, patternUTF8Length+1, UTF8Converter, status); in regex_find()
3434 utext_openUTF8(&patternText, patternChars, patternUTF8Length, &status); in regex_find()
3436 if (status == U_ZERO_ERROR) { in regex_find()
3437 UTF8Pattern = RegexPattern::compile(&patternText, bflags, pe, status); in regex_find()
3439 if (status != U_ZERO_ERROR) { in regex_find()
3443 if (flags.indexOf((UChar)0x76) >= 0 /*'v'*/ && status == U_UNSUPPORTED_ERROR) { in regex_find()
3450 logln("Pattern Compile returns \"%s\" (UTF8)", u_errorName(status)); in regex_find()
3455 errln("Line %d: error %s compiling pattern. (UTF8)", line, u_errorName(status)); in regex_find()
3464 status = U_ZERO_ERROR; in regex_find()
3503 parsePat = RegexPattern::compile("<(/?)(r|[0-9]+)>", 0, pe, status); in regex_find()
3504 if (!assertSuccess(WHERE, status) ) { in regex_find()
3509 parseMatcher = parsePat->matcher(unEscapedInput, status); in regex_find()
3510 if (!assertSuccess(WHERE, status) ) { in regex_find()
3514 parseMatcher->appendReplacement(deTaggedInput, "", status); in regex_find()
3516 UnicodeString groupNum = parseMatcher->group(2, status); in regex_find()
3519 if (parseMatcher->group(1, status) == "/") { in regex_find()
3526 if (parseMatcher->group(1, status) == "/") { in regex_find()
3549 matcher = callerPattern->matcher(deTaggedInput, status); in regex_find()
3556 inputUTF8Length = deTaggedInput.extract(NULL, 0, UTF8Converter, status); in regex_find()
3557 status = U_ZERO_ERROR; // buffer overflow in regex_find()
3559 deTaggedInput.extract(inputChars, inputUTF8Length+1, UTF8Converter, status); in regex_find()
3560 utext_openUTF8(&inputText, inputChars, inputUTF8Length, &status); in regex_find()
3562 if (status == U_ZERO_ERROR) { in regex_find()
3563 UTF8Matcher = &UTF8Pattern->matcher(status)->reset(&inputText); in regex_find()
3570 status = U_ZERO_ERROR; in regex_find()
3614 matcher->region(regionStart, regionEnd, status); in regex_find()
3617 UTF8Matcher->region(regionStartUTF8, regionEndUTF8, status); in regex_find()
3643 isMatch = matcher->matches(status); in regex_find()
3645 isUTF8Match = UTF8Matcher->matches(status); in regex_find()
3648 isMatch = matcher->lookingAt(status); in regex_find()
3650 isUTF8Match = UTF8Matcher->lookingAt(status); in regex_find()
3663 if (U_FAILURE(status)) { in regex_find()
3664 errln("Error at line %d. ICU ErrorCode is %s", u_errorName(status)); in regex_find()
3685 …Error at line %d: No match expected, but one found at position %d.", line, matcher->start(status)); in regex_find()
3689 …e %d: No match expected, but one found at position %d (UTF-8).", line, UTF8Matcher->start(status)); in regex_find()
3702 if (matcher->start(i, status) != expectedStart) { in regex_find()
3704 line, i, expectedStart, matcher->start(i, status)); in regex_find()
3707 } else if (UTF8Matcher != NULL && UTF8Matcher->start(i, status) != expectedStartUTF8) { in regex_find()
3709 line, i, expectedStartUTF8, UTF8Matcher->start(i, status)); in regex_find()
3716 if (matcher->end(i, status) != expectedEnd) { in regex_find()
3718 line, i, expectedEnd, matcher->end(i, status)); in regex_find()
3722 } else if (UTF8Matcher != NULL && UTF8Matcher->end(i, status) != expectedEndUTF8) { in regex_find()
3724 line, i, expectedEndUTF8, UTF8Matcher->end(i, status)); in regex_find()
3831 UErrorCode status = U_ZERO_ERROR; in Errors() local
3835 RegexPattern *pat1= RegexPattern::compile(".*", flags, pe, status); in Errors()
3836 REGEX_ASSERT(status == U_REGEX_UNIMPLEMENTED); in Errors()
3915 UErrorCode status = U_ZERO_ERROR; in PerlTests() local
3927 UChar *testData = ReadAndConvertFile(srcPath, len, "iso-8859-1", status); in PerlTests()
3928 if (U_FAILURE(status)) { in PerlTests()
3941 …exPattern* linePat = RegexPattern::compile(UNICODE_STRING_SIMPLE("(.+?)[\\r\\n]+"), 0, pe, status); in PerlTests()
3942 if (U_FAILURE(status)) { in PerlTests()
3946 RegexMatcher* lineMat = linePat->matcher(testDataString, status); in PerlTests()
3952 RegexPattern* fieldPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("\\t"), 0, pe, status); in PerlTests()
3960 …xPattern *flagPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("('?)(.*)\\1(.*)"), 0, pe, status); in PerlTests()
3961 RegexMatcher* flagMat = flagPat->matcher(status); in PerlTests()
3977 …groupsPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("\\$([+\\-])\\[(\\d+)\\]"), 0, pe, status); in PerlTests()
3978 RegexMatcher *groupsMat = groupsPat->matcher(status); in PerlTests()
3981 RegexPattern *cgPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("\\$(\\d+)"), 0, pe, status); in PerlTests()
3982 RegexMatcher *cgMat = cgPat->matcher(status); in PerlTests()
3998 UnicodeString line = lineMat->group(1, status); in PerlTests()
4000 fieldPat->split(line, fields, 7, status); in PerlTests()
4003 flagMat->matches(status); in PerlTests()
4004 UnicodeString pattern = flagMat->group(2, status); in PerlTests()
4013 UnicodeString flagStr = flagMat->group(3, status); in PerlTests()
4014 if (U_FAILURE(status)) { in PerlTests()
4015 errln("ucnv_toUChars: ICU Error \"%s\"\n", u_errorName(status)); in PerlTests()
4037 status = U_ZERO_ERROR; in PerlTests()
4038 RegexPattern *testPat = RegexPattern::compile(pattern, flags, pe, status); in PerlTests()
4039 if (status == U_REGEX_UNIMPLEMENTED) { in PerlTests()
4045 status = U_ZERO_ERROR; in PerlTests()
4049 if (U_FAILURE(status)) { in PerlTests()
4055 errln("line %d: ICU Error \"%s\"\n", lineNum, u_errorName(status)); in PerlTests()
4057 status = U_ZERO_ERROR; in PerlTests()
4093 RegexMatcher *testMat = testPat->matcher(matchString, status); in PerlTests()
4137 resultString.append(testMat->group(status)); in PerlTests()
4141 else if (groupsMat->lookingAt(status)) { in PerlTests()
4143 UnicodeString digitString = groupsMat->group(2, status); in PerlTests()
4146 UnicodeString plusOrMinus = groupsMat->group(1, status); in PerlTests()
4149 matchPosition = testMat->end(groupNum, status); in PerlTests()
4151 matchPosition = testMat->start(groupNum, status); in PerlTests()
4156 perlExpr.remove(0, groupsMat->end(status)); in PerlTests()
4159 else if (cgMat->lookingAt(status)) { in PerlTests()
4161 UnicodeString digitString = cgMat->group(1, status); in PerlTests()
4164 if (U_SUCCESS(status)) { in PerlTests()
4165 resultString.append(testMat->group(groupNum, status)); in PerlTests()
4166 status = U_ZERO_ERROR; in PerlTests()
4168 perlExpr.remove(0, cgMat->end(status)); in PerlTests()
4177 ICU_Utility::appendNumber(resultString, testMat->start(i, status)); in PerlTests()
4188 ICU_Utility::appendNumber(resultString, testMat->end(i, status)); in PerlTests()
4215 if (U_FAILURE(status)) { in PerlTests()
4216 errln("Line %d: ICU Error \"%s\"", lineNum, u_errorName(status)); in PerlTests()
4275 UErrorCode status = U_ZERO_ERROR; in PerlTestsUTF8() local
4277 LocalUConverterPointer UTF8Converter(ucnv_open("UTF-8", &status)); in PerlTestsUTF8()
4287 …v_setFromUCallBack(UTF8Converter.getAlias(), UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status); in PerlTestsUTF8()
4298 UChar *testData = ReadAndConvertFile(srcPath, len, "iso-8859-1", status); in PerlTestsUTF8()
4299 if (U_FAILURE(status)) { in PerlTestsUTF8()
4312 …exPattern* linePat = RegexPattern::compile(UNICODE_STRING_SIMPLE("(.+?)[\\r\\n]+"), 0, pe, status); in PerlTestsUTF8()
4313 if (U_FAILURE(status)) { in PerlTestsUTF8()
4317 RegexMatcher* lineMat = linePat->matcher(testDataString, status); in PerlTestsUTF8()
4323 RegexPattern* fieldPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("\\t"), 0, pe, status); in PerlTestsUTF8()
4331 …xPattern *flagPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("('?)(.*)\\1(.*)"), 0, pe, status); in PerlTestsUTF8()
4332 RegexMatcher* flagMat = flagPat->matcher(status); in PerlTestsUTF8()
4348 …groupsPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("\\$([+\\-])\\[(\\d+)\\]"), 0, pe, status); in PerlTestsUTF8()
4349 RegexMatcher *groupsMat = groupsPat->matcher(status); in PerlTestsUTF8()
4352 RegexPattern *cgPat = RegexPattern::compile(UNICODE_STRING_SIMPLE("\\$(\\d+)"), 0, pe, status); in PerlTestsUTF8()
4353 RegexMatcher *cgMat = cgPat->matcher(status); in PerlTestsUTF8()
4369 UnicodeString line = lineMat->group(1, status); in PerlTestsUTF8()
4371 fieldPat->split(line, fields, 7, status); in PerlTestsUTF8()
4374 flagMat->matches(status); in PerlTestsUTF8()
4375 UnicodeString pattern = flagMat->group(2, status); in PerlTestsUTF8()
4384 UnicodeString flagStr = flagMat->group(3, status); in PerlTestsUTF8()
4385 if (U_FAILURE(status)) { in PerlTestsUTF8()
4386 errln("ucnv_toUChars: ICU Error \"%s\"\n", u_errorName(status)); in PerlTestsUTF8()
4408 status = U_ZERO_ERROR; in PerlTestsUTF8()
4409 … patternLength = pattern.extract(patternChars, patternCapacity, UTF8Converter.getAlias(), status); in PerlTestsUTF8()
4410 if (status == U_BUFFER_OVERFLOW_ERROR) { in PerlTestsUTF8()
4411 status = U_ZERO_ERROR; in PerlTestsUTF8()
4415 pattern.extract(patternChars, patternCapacity, UTF8Converter.getAlias(), status); in PerlTestsUTF8()
4417 utext_openUTF8(&patternText, patternChars, patternLength, &status); in PerlTestsUTF8()
4422 RegexPattern *testPat = RegexPattern::compile(&patternText, flags, pe, status); in PerlTestsUTF8()
4423 if (status == U_REGEX_UNIMPLEMENTED) { in PerlTestsUTF8()
4429 status = U_ZERO_ERROR; in PerlTestsUTF8()
4433 if (U_FAILURE(status)) { in PerlTestsUTF8()
4439 errln("line %d: ICU Error \"%s\"\n", lineNum, u_errorName(status)); in PerlTestsUTF8()
4441 status = U_ZERO_ERROR; in PerlTestsUTF8()
4476 status = U_ZERO_ERROR; in PerlTestsUTF8()
4477 … inputLength = matchString.extract(inputChars, inputCapacity, UTF8Converter.getAlias(), status); in PerlTestsUTF8()
4478 if (status == U_BUFFER_OVERFLOW_ERROR) { in PerlTestsUTF8()
4479 status = U_ZERO_ERROR; in PerlTestsUTF8()
4483 matchString.extract(inputChars, inputCapacity, UTF8Converter.getAlias(), status); in PerlTestsUTF8()
4485 utext_openUTF8(&inputText, inputChars, inputLength, &status); in PerlTestsUTF8()
4490 RegexMatcher *testMat = &testPat->matcher(status)->reset(&inputText); in PerlTestsUTF8()
4527 resultString.append(testMat->group(status)); in PerlTestsUTF8()
4531 else if (groupsMat->lookingAt(status)) { in PerlTestsUTF8()
4533 UnicodeString digitString = groupsMat->group(2, status); in PerlTestsUTF8()
4536 UnicodeString plusOrMinus = groupsMat->group(1, status); in PerlTestsUTF8()
4539 matchPosition = testMat->end(groupNum, status); in PerlTestsUTF8()
4541 matchPosition = testMat->start(groupNum, status); in PerlTestsUTF8()
4546 perlExpr.remove(0, groupsMat->end(status)); in PerlTestsUTF8()
4549 else if (cgMat->lookingAt(status)) { in PerlTestsUTF8()
4551 UnicodeString digitString = cgMat->group(1, status); in PerlTestsUTF8()
4554 if (U_SUCCESS(status)) { in PerlTestsUTF8()
4555 resultString.append(testMat->group(groupNum, status)); in PerlTestsUTF8()
4556 status = U_ZERO_ERROR; in PerlTestsUTF8()
4558 perlExpr.remove(0, cgMat->end(status)); in PerlTestsUTF8()
4567 ICU_Utility::appendNumber(resultString, testMat->start(i, status)); in PerlTestsUTF8()
4578 ICU_Utility::appendNumber(resultString, testMat->end(i, status)); in PerlTestsUTF8()
4605 if (U_FAILURE(status)) { in PerlTestsUTF8()
4606 errln("Line %d: ICU Error \"%s\"", lineNum, u_errorName(status)); in PerlTestsUTF8()
4673 UErrorCode status = U_ZERO_ERROR; in Bug6149() local
4675 RegexMatcher matcher(pattern, s, flags, status); in Bug6149()
4677 REGEX_ASSERT_FAIL(result=matcher.matches(status), U_REGEX_STACK_OVERFLOW); in Bug6149()
4719 UErrorCode status = U_ZERO_ERROR; in Callbacks() local
4720 RegexMatcher matcher("x", 0, status); in Callbacks()
4722 matcher.getMatchCallback(returnedFn, returnedContext, status); in Callbacks()
4733 UErrorCode status = U_ZERO_ERROR; in Callbacks() local
4734 …RegexMatcher matcher(UNICODE_STRING_SIMPLE("((.)+\\2)+x"), 0, status); // A pattern that can run … in Callbacks()
4736 matcher.setMatchCallback(testCallBackFn, &cbInfo, status); in Callbacks()
4738 matcher.getMatchCallback(returnedFn, returnedContext, status); in Callbacks()
4744 status = U_ZERO_ERROR; in Callbacks()
4748 REGEX_ASSERT(matcher.matches(status)); in Callbacks()
4754 status = U_ZERO_ERROR; in Callbacks()
4758 REGEX_ASSERT(matcher.matches(status)==false); in Callbacks()
4763 status = U_ZERO_ERROR; in Callbacks()
4767 REGEX_ASSERT(matcher.matches(status)==false); in Callbacks()
4768 REGEX_ASSERT(status == U_REGEX_STOPPED_BY_CALLER); in Callbacks()
4772 status = U_ZERO_ERROR; in Callbacks()
4776 REGEX_ASSERT(matcher.find(status)==false); in Callbacks()
4777 REGEX_ASSERT(status == U_REGEX_STOPPED_BY_CALLER); in Callbacks()
4823 UErrorCode status = U_ZERO_ERROR; in FindProgressCallbacks() local
4824 RegexMatcher matcher("x", 0, status); in FindProgressCallbacks()
4826 matcher.getFindProgressCallback(returnedFn, returnedContext, status); in FindProgressCallbacks()
4837 UErrorCode status = U_ZERO_ERROR; in FindProgressCallbacks() local
4838 RegexMatcher matcher(UNICODE_STRING_SIMPLE("((.)\\2)x"), 0, status); in FindProgressCallbacks()
4840 matcher.setFindProgressCallback(testProgressCallBackFn, &cbInfo, status); in FindProgressCallbacks()
4842 matcher.getFindProgressCallback(returnedFn, returnedContext, status); in FindProgressCallbacks()
4848 status = U_ZERO_ERROR; in FindProgressCallbacks()
4855 REGEX_ASSERT(matcher.find(0, status)); in FindProgressCallbacks()
4861 status = U_ZERO_ERROR; in FindProgressCallbacks()
4865 REGEX_ASSERT(matcher.find(0, status)==false); in FindProgressCallbacks()
4870 status = U_ZERO_ERROR; in FindProgressCallbacks()
4874 REGEX_ASSERT(matcher.find(0, status)==false); in FindProgressCallbacks()
4875 REGEX_ASSERT(status == U_REGEX_STOPPED_BY_CALLER); in FindProgressCallbacks()
4879 status = U_ZERO_ERROR; in FindProgressCallbacks()
4883 REGEX_ASSERT(matcher.find(0, status)==false); in FindProgressCallbacks()
4884 REGEX_ASSERT(status == U_REGEX_STOPPED_BY_CALLER); in FindProgressCallbacks()
4887 status = U_ZERO_ERROR; in FindProgressCallbacks()
4888 REGEX_ASSERT(matcher.find(cbInfo.lastIndex, status)); in FindProgressCallbacks()
4905 UErrorCode status = U_ZERO_ERROR; in PreAllocatedUTextCAPI() local
4911 utext_openUnicodeString(&bufferText, &buffer, &status); in PreAllocatedUTextCAPI()
4922 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
4923 regextst_openUTF8FromInvariant(&text1, "abcccd", -1, &status); in PreAllocatedUTextCAPI()
4924 regextst_openUTF8FromInvariant(&text2, "abcccxd", -1, &status); in PreAllocatedUTextCAPI()
4926 utext_openUChars(&text2, text2Chars, -1, &status); in PreAllocatedUTextCAPI()
4928 regextst_openUTF8FromInvariant(&patternText, "abc*d", -1, &status); in PreAllocatedUTextCAPI()
4929 re = uregex_openUText(&patternText, 0, NULL, &status); in PreAllocatedUTextCAPI()
4932 uregex_setUText(re, &text1, &status); in PreAllocatedUTextCAPI()
4933 resultText = uregex_getUText(re, &bufferText, &status); in PreAllocatedUTextCAPI()
4940 resultText = uregex_getUText(re, &bufferText, &status); in PreAllocatedUTextCAPI()
4948 uregex_setText(re, text2Chars, 7, &status); in PreAllocatedUTextCAPI()
4949 resultText = uregex_getUText(re, &bufferText, &status); in PreAllocatedUTextCAPI()
4974 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
4975 re = uregex_openC("abc(.*?)def", 0, NULL, &status); in PreAllocatedUTextCAPI()
4978 uregex_setText(re, text1, -1, &status); in PreAllocatedUTextCAPI()
4979 result = uregex_find(re, 0, &status); in PreAllocatedUTextCAPI()
4983 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
4984 actual = uregex_groupUText(re, 0, &bufferText, &length, &status); in PreAllocatedUTextCAPI()
4992 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
4993 actual = uregex_groupUText(re, 1, &bufferText, &length, &status); in PreAllocatedUTextCAPI()
5001 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
5002 actual = uregex_groupUText(re, 2, &bufferText, &length, &status); in PreAllocatedUTextCAPI()
5003 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in PreAllocatedUTextCAPI()
5017 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
5018 utext_openUnicodeString(&bufferText, &buffer, &status); in PreAllocatedUTextCAPI()
5020 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
5023 regextst_openUTF8FromInvariant(&replText, "<$1>", -1, &status); in PreAllocatedUTextCAPI()
5025 re = uregex_openC("x(.*?)x", 0, NULL, &status); in PreAllocatedUTextCAPI()
5029 uregex_setText(re, text1, -1, &status); in PreAllocatedUTextCAPI()
5031 utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status); in PreAllocatedUTextCAPI()
5033 result = uregex_replaceFirstUText(re, &replText, &bufferText, &status); in PreAllocatedUTextCAPI()
5039 uregex_setText(re, text2, -1, &status); in PreAllocatedUTextCAPI()
5040 utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status); in PreAllocatedUTextCAPI()
5041 result = uregex_replaceFirstUText(re, &replText, &bufferText, &status); in PreAllocatedUTextCAPI()
5047 uregex_setText(re, text1, -1, &status); in PreAllocatedUTextCAPI()
5048 regextst_openUTF8FromInvariant(&replText, "\\\\\\u0041$1\\U00000042\\$\\a", -1, &status); in PreAllocatedUTextCAPI()
5049 utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status); in PreAllocatedUTextCAPI()
5050 result = uregex_replaceFirstUText(re, &replText, &bufferText, &status); in PreAllocatedUTextCAPI()
5069 status = U_ZERO_ERROR; in PreAllocatedUTextCAPI()
5072 regextst_openUTF8FromInvariant(&replText, "<$1>", -1, &status); in PreAllocatedUTextCAPI()
5074 re = uregex_openC("x(.*?)x", 0, NULL, &status); in PreAllocatedUTextCAPI()
5078 uregex_setText(re, text1, -1, &status); in PreAllocatedUTextCAPI()
5079 utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status); in PreAllocatedUTextCAPI()
5080 result = uregex_replaceAllUText(re, &replText, &bufferText, &status); in PreAllocatedUTextCAPI()
5086 uregex_setText(re, text2, -1, &status); in PreAllocatedUTextCAPI()
5087 utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status); in PreAllocatedUTextCAPI()
5088 result = uregex_replaceAllUText(re, &replText, &bufferText, &status); in PreAllocatedUTextCAPI()
5114 UErrorCode status = U_ZERO_ERROR; in NamedCapture() local
5116 "abc()()(?<three>xyz)(de)(?<five>hmm)(?<six>oh)f\\k<five>"), 0, status); in NamedCapture()
5118 int32_t group = pat->groupNumberFromName("five", -1, status); in NamedCapture()
5121 group = pat->groupNumberFromName("three", -1, status); in NamedCapture()
5125 status = U_ZERO_ERROR; in NamedCapture()
5126 group = pat->groupNumberFromName(UnicodeString("six"), status); in NamedCapture()
5130 status = U_ZERO_ERROR; in NamedCapture()
5131 group = pat->groupNumberFromName(UnicodeString("nosuch"), status); in NamedCapture()
5132 U_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5134 status = U_ZERO_ERROR; in NamedCapture()
5141 group = copiedPat->groupNumberFromName("five", -1, status); in NamedCapture()
5144 group = copiedPat->groupNumberFromName("three", -1, status); in NamedCapture()
5150 status = U_ZERO_ERROR; in NamedCapture()
5152 RegexMatcher *m = new RegexMatcher(UnicodeString("<<(?<mid>.+?)>>"), text, 0, status); in NamedCapture()
5155 UnicodeString replacedText = m->replaceAll("'${mid}'", status); in NamedCapture()
5162 m = new RegexMatcher(UnicodeString("..(?<one>m)(.)(.)"), text, 0, status); in NamedCapture()
5165 status = U_ZERO_ERROR; in NamedCapture()
5166 …replacedText = m->replaceAll(UnicodeString("<$0>"), status); // group 0, full match, is allowed. in NamedCapture()
5170 status = U_ZERO_ERROR; in NamedCapture()
5171 replacedText = m->replaceAll(UnicodeString("<$1>"), status); // group 1 by number. in NamedCapture()
5175 status = U_ZERO_ERROR; in NamedCapture()
5176 replacedText = m->replaceAll(UnicodeString("<${one}>"), status); // group 1 by name. in NamedCapture()
5180 status = U_ZERO_ERROR; in NamedCapture()
5181 replacedText = m->replaceAll(UnicodeString("<$2>"), status); // group 2. in NamedCapture()
5185 status = U_ZERO_ERROR; in NamedCapture()
5186 replacedText = m->replaceAll(UnicodeString("<$3>"), status); in NamedCapture()
5190 status = U_ZERO_ERROR; in NamedCapture()
5191 replacedText = m->replaceAll(UnicodeString("<$4>"), status); in NamedCapture()
5192 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in NamedCapture()
5194 status = U_ZERO_ERROR; in NamedCapture()
5195 replacedText = m->replaceAll(UnicodeString("<$04>"), status); // group 0, leading 0, in NamedCapture()
5199 status = U_ZERO_ERROR; in NamedCapture()
5200 …replacedText = m->replaceAll(UnicodeString("<$000016>"), status); // Consume leading zeroes. Don… in NamedCapture()
5204 status = U_ZERO_ERROR; in NamedCapture()
5205 replacedText = m->replaceAll(UnicodeString("<$3$2$1${one}>"), status); in NamedCapture()
5209 status = U_ZERO_ERROR; in NamedCapture()
5210 replacedText = m->replaceAll(UnicodeString("$3$2$1${one}"), status); in NamedCapture()
5214 status = U_ZERO_ERROR; in NamedCapture()
5215 replacedText = m->replaceAll(UnicodeString("<${noSuchName}>"), status); in NamedCapture()
5216 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5218 status = U_ZERO_ERROR; in NamedCapture()
5219 replacedText = m->replaceAll(UnicodeString("<${invalid-name}>"), status); in NamedCapture()
5220 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5222 status = U_ZERO_ERROR; in NamedCapture()
5223 replacedText = m->replaceAll(UnicodeString("<${one"), status); in NamedCapture()
5224 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5226 status = U_ZERO_ERROR; in NamedCapture()
5227 replacedText = m->replaceAll(UnicodeString("$not a capture group"), status); in NamedCapture()
5228 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5236 status = U_ZERO_ERROR; in NamedCapture()
5237 URegularExpression *re = uregex_openC("..(?<one>m)(.)(.)", 0, NULL, &status); in NamedCapture()
5240 uregex_setText(re, text.getBuffer(), text.length(), &status); in NamedCapture()
5247 status = U_ZERO_ERROR; in NamedCapture()
5249 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5253 status = U_ZERO_ERROR; in NamedCapture()
5255 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5259 status = U_ZERO_ERROR; in NamedCapture()
5261 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5265 status = U_ZERO_ERROR; in NamedCapture()
5267 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5271 status = U_ZERO_ERROR; in NamedCapture()
5273 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5277 status = U_ZERO_ERROR; in NamedCapture()
5279 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5280 REGEX_ASSERT(status == U_INDEX_OUTOFBOUNDS_ERROR); in NamedCapture()
5282 status = U_ZERO_ERROR; in NamedCapture()
5284 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5288 status = U_ZERO_ERROR; in NamedCapture()
5290 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5294 status = U_ZERO_ERROR; in NamedCapture()
5296 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5300 status = U_ZERO_ERROR; in NamedCapture()
5302 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5306 status = U_ZERO_ERROR; in NamedCapture()
5308 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5309 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5311 status = U_ZERO_ERROR; in NamedCapture()
5313 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5314 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5316 status = U_ZERO_ERROR; in NamedCapture()
5318 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5319 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5321 status = U_ZERO_ERROR; in NamedCapture()
5323 …egex_replaceAll(re, repl.getBuffer(), repl.length(), resultBuf, UPRV_LENGTHOF(resultBuf), &status); in NamedCapture()
5324 REGEX_ASSERT(status == U_REGEX_INVALID_CAPTURE_GROUP_NAME); in NamedCapture()
5352 UErrorCode status = U_ZERO_ERROR; in NamedCaptureLimits() local
5353 RegexPattern *pat = RegexPattern::compile(pattern, 0, status); in NamedCaptureLimits()
5357 int32_t groupNum = pat->groupNumberFromName(nnbuf, -1, status); in NamedCaptureLimits()
5370 status = U_ZERO_ERROR; in NamedCaptureLimits()
5371 pat = RegexPattern::compile(pattern, 0, status); in NamedCaptureLimits()
5372 REGEX_ASSERT(status == U_REGEX_PATTERN_TOO_BIG); in NamedCaptureLimits()
5390 UErrorCode status = U_ZERO_ERROR; in Bug7651() local
5393 REPattern = RegexPattern::compile(pattern1, 0, pe, status); in Bug7651()
5395 REMatcher = REPattern->matcher(s, status); in Bug7651()
5398 REGEX_ASSERT(REMatcher->start(status) == 0); in Bug7651()
5401 status = U_ZERO_ERROR; in Bug7651()
5403 REPattern = RegexPattern::compile(pattern2, 0, pe, status); in Bug7651()
5405 REMatcher = REPattern->matcher(s, status); in Bug7651()
5408 REGEX_ASSERT(REMatcher->start(status) == 0); in Bug7651()
5411 status = U_ZERO_ERROR; in Bug7651()
5415 UErrorCode status = U_ZERO_ERROR; in Bug7740() local
5418 RegexMatcher *m = new RegexMatcher(pattern, text, 0, status); in Bug7740()
5420 REGEX_ASSERT(m->lookingAt(status)); in Bug7740()
5422 status = U_ILLEGAL_ARGUMENT_ERROR; in Bug7740()
5423 UnicodeString s = m->group(1, status); // Bug 7740: segfault here. in Bug7740()
5424 REGEX_ASSERT(status == U_ILLEGAL_ARGUMENT_ERROR); in Bug7740()
5432 UErrorCode status = U_ZERO_ERROR; in Bug8479() local
5434 …her* const pMatcher = new RegexMatcher("\\Aboo\\z", UREGEX_DOTALL|UREGEX_CASE_INSENSITIVE, status); in Bug8479()
5436 if (U_SUCCESS(status)) in Bug8479()
5441 status = U_ZERO_ERROR; in Bug8479()
5442 pMatcher->matches(status); in Bug8479()
5443 REGEX_ASSERT(status == U_ILLEGAL_ARGUMENT_ERROR); in Bug8479()
5451 UErrorCode status = U_ZERO_ERROR; in Bug7029() local
5453 RegexMatcher* const pMatcher = new RegexMatcher(".", 0, status); in Bug7029()
5457 int32_t numFields = pMatcher->split(text, splits, 10, status); in Bug7029()
5476 UErrorCode status = U_ZERO_ERROR; in Bug9283() local
5477 UnicodeSet supplementalsWithCaseFolding("[[:CWCF:]&[\\U00010000-\\U0010FFFF]]", status); in Bug9283()
5504 UErrorCode status = U_ZERO_ERROR; in Bug10459() local
5508 UText *utext_pat = utext_openUnicodeString(NULL, &patternString, &status); in Bug10459()
5510 UText *utext_txt = utext_openUnicodeString(NULL, &txtString, &status); in Bug10459()
5513 URegularExpression *icu_re = uregex_openUText(utext_pat, 0, NULL, &status); in Bug10459()
5516 uregex_setUText(icu_re, utext_txt, &status); in Bug10459()
5524 int32_t len = uregex_group(icu_re, 0, buf, UPRV_LENGTHOF(buf), &status); in Bug10459()
5525 REGEX_ASSERT(status == U_REGEX_INVALID_STATE); in Bug10459()
5584 UErrorCode status = U_ZERO_ERROR; in TestCase11049() local
5586 LocalPointer<RegexPattern> compiledPat(RegexPattern::compile(patternString, 0, status)); in TestCase11049()
5590 dataString.extract(exactBuffer, dataString.length(), status); in TestCase11049()
5591 UText *ut = utext_openUChars(NULL, exactBuffer, dataString.length(), &status); in TestCase11049()
5593 LocalPointer<RegexMatcher> matcher(compiledPat->matcher(status)); in TestCase11049()
5607 …ic_cast<int32_t>(uprv_strlen(data)+1), NULL, dataString.getBuffer(), dataString.length(), &status); in TestCase11049()
5609 ut = utext_openUTF8(ut, utf8Buffer, -1, &status); in TestCase11049()
5629 UErrorCode status = U_ZERO_ERROR; in TestBug11371() local
5635 LocalPointer<RegexPattern> compiledPat(RegexPattern::compile(patternString, 0, status)); in TestBug11371()
5636 if (status != U_REGEX_PATTERN_TOO_BIG) { in TestBug11371()
5638 __FILE__, __LINE__, u_errorName(status)); in TestBug11371()
5641 status = U_ZERO_ERROR; in TestBug11371()
5647 LocalPointer<RegexPattern> compiledPat2(RegexPattern::compile(patternString, 0, status)); in TestBug11371()
5648 if (status != U_REGEX_PATTERN_TOO_BIG) { in TestBug11371()
5650 __FILE__, __LINE__, u_errorName(status)); in TestBug11371()
5655 status = U_ZERO_ERROR; in TestBug11371()
5661 LocalPointer<RegexPattern> compiledPat3(RegexPattern::compile(patternString, 0, status)); in TestBug11371()
5662 if (status != U_REGEX_PATTERN_TOO_BIG) { in TestBug11371()
5664 __FILE__, __LINE__, u_errorName(status)); in TestBug11371()
5673 UErrorCode status = U_ZERO_ERROR; in TestBug11480() local
5674 URegularExpression *re = uregex_openC("(A)|(B)", 0, NULL, &status); in TestBug11480()
5677 uregex_setText(re, text.getBuffer(), text.length(), &status); in TestBug11480()
5679 REGEX_ASSERT(uregex_lookingAt(re, 0, &status)); in TestBug11480()
5681 int32_t length = uregex_group(re, 2, buf+1, UPRV_LENGTHOF(buf)-1, &status); in TestBug11480()
5690 utext_openUnicodeString(&ut, &text, &status); in TestBug11480()
5691 RegexMatcher matcher(UnicodeString("(A)|(B)"), 0, status); in TestBug11480()
5694 REGEX_ASSERT(matcher.lookingAt(0, status)); in TestBug11480()
5699 matcher.group(1, &group, groupLen, status); in TestBug11480()
5705 matcher.group(2, &group, groupLen, status); in TestBug11480()
5708 REGEX_ASSERT(matcher.start(2, status) == -1); in TestBug11480()
5716 UErrorCode status = U_ZERO_ERROR; in TestBug12884() local
5717 RegexMatcher m(pattern, text, 0, status); in TestBug12884()
5719 m.setTimeLimit(5, status); in TestBug12884()
5720 m.find(status); in TestBug12884()
5721 REGEX_ASSERT(status == U_REGEX_TIME_OUT); in TestBug12884()
5725 status = U_ZERO_ERROR; in TestBug12884()
5726 RegexMatcher ngM(ngPattern, text, 0, status); in TestBug12884()
5728 ngM.setTimeLimit(5, status); in TestBug12884()
5729 ngM.find(status); in TestBug12884()
5730 REGEX_ASSERT(status == U_REGEX_TIME_OUT); in TestBug12884()
5736 status = U_ZERO_ERROR; in TestBug12884()
5737 LocalUTextPointer ut(utext_openUTF8(NULL, text8.data(), text8.length(), &status)); in TestBug12884()
5740 m.find(status); in TestBug12884()
5741 REGEX_ASSERT(status == U_REGEX_TIME_OUT); in TestBug12884()
5743 status = U_ZERO_ERROR; in TestBug12884()
5745 ngM.find(status); in TestBug12884()
5746 REGEX_ASSERT(status == U_REGEX_TIME_OUT); in TestBug12884()
5759 UErrorCode status = U_ZERO_ERROR; in TestBug13631() local
5761 RegexMatcher matcher(upat, 0, status); in TestBug13631()
5763 UText *ut = utext_openUChars(nullptr, &s, 1, &status); in TestBug13631()
5777 UErrorCode status = U_ZERO_ERROR; in TestBug13632() local
5778 URegularExpression *re = uregex_openC(" ", 0, nullptr, &status); in TestBug13632()
5780 uregex_setText(re, sourceString, u_strlen(sourceString), &status); in TestBug13632()
5785 uregex_replaceAll(re, replacement, 2, dest, destCap, &status); in TestBug13632()
5787 assertEquals("", U_REGEX_INVALID_CAPTURE_GROUP_NAME, status); in TestBug13632()
5802 UErrorCode status = U_ZERO_ERROR; in TestBug20359() local
5804 0, nullptr, &status)); in TestBug20359()
5805 assertSuccess(WHERE, status); in TestBug20359()
5810 uregex_setText(re.getAlias(), u"abcxyz", -1, &status); in TestBug20359()
5811 assertSuccess(WHERE, status); in TestBug20359()
5812 assertTrue(WHERE, uregex_find(re.getAlias(), 0, &status)); in TestBug20359()
5813 assertEquals(WHERE, 3, uregex_start(re.getAlias(), 0, &status)); in TestBug20359()
5814 assertSuccess(WHERE, status); in TestBug20359()
5841 UErrorCode status = U_ZERO_ERROR; in TestBug20863() local
5843 LocalPointer<RegexPattern> pattern(RegexPattern::compile(patternString, pe, status), status); in TestBug20863()
5844 if (!assertSuccess(WHERE, status)) { in TestBug20863()
5849 int32_t group = pattern->groupNumberFromName(groupNames[i], status); in TestBug20863()
5850 if (!assertSuccess(WHERE, status)) { in TestBug20863()
5860 LocalPointer<RegexPattern> pat1(RegexPattern::compile(u"abc", pe, status), status); in TestBug20863()
5861 LocalPointer<RegexPattern> pat2(RegexPattern::compile(u"a(?<name>b)c", pe, status), status); in TestBug20863()
5862 assertSuccess(WHERE, status); in TestBug20863()
5866 assertEquals(WHERE, 1, pat1->groupNumberFromName(u"name", status)); in TestBug20863()
5867 assertEquals(WHERE, 1, pat2->groupNumberFromName(u"name", status)); in TestBug20863()
5868 assertSuccess(WHERE, status); in TestBug20863()
5872 LocalPointer<RegexPattern> pat1(RegexPattern::compile(u"abc", pe, status), status); in TestBug20863()
5873 LocalPointer<RegexPattern> pat2(RegexPattern::compile(u"a(?<name>b)c", pe, status), status); in TestBug20863()
5874 assertSuccess(WHERE, status); in TestBug20863()
5878 assertEquals(WHERE, 0, pat1->groupNumberFromName(u"name", status)); in TestBug20863()
5879 assertEquals(WHERE, U_REGEX_INVALID_CAPTURE_GROUP_NAME, status); in TestBug20863()
5880 status = U_ZERO_ERROR; in TestBug20863()
5881 assertEquals(WHERE, 0, pat2->groupNumberFromName(u"name", status)); in TestBug20863()
5882 assertEquals(WHERE, U_REGEX_INVALID_CAPTURE_GROUP_NAME, status); in TestBug20863()
5883 status = U_ZERO_ERROR; in TestBug20863()
5887 … LocalPointer<RegexPattern> pat1(RegexPattern::compile(u"a(?<name1>b)c", pe, status), status); in TestBug20863()
5888 … LocalPointer<RegexPattern> pat2(RegexPattern::compile(u"a(?<name2>b)c", pe, status), status); in TestBug20863()
5889 assertSuccess(WHERE, status); in TestBug20863()
5893 assertEquals(WHERE, 1, pat1->groupNumberFromName(u"name1", status)); in TestBug20863()
5894 assertSuccess(WHERE, status); in TestBug20863()
5895 assertEquals(WHERE, 1, pat2->groupNumberFromName(u"name1", status)); in TestBug20863()
5896 assertSuccess(WHERE, status); in TestBug20863()
5897 assertEquals(WHERE, 0, pat1->groupNumberFromName(u"name2", status)); in TestBug20863()
5898 assertEquals(WHERE, U_REGEX_INVALID_CAPTURE_GROUP_NAME, status); in TestBug20863()
5899 status = U_ZERO_ERROR; in TestBug20863()
5900 assertEquals(WHERE, 0, pat2->groupNumberFromName(u"name2", status)); in TestBug20863()
5901 assertEquals(WHERE, U_REGEX_INVALID_CAPTURE_GROUP_NAME, status); in TestBug20863()
5902 status = U_ZERO_ERROR; in TestBug20863()