• Home
  • Raw
  • Download

Lines Matching refs:RE2

21 TEST(RE2, HexTests) {  in TEST()  argument
28 CHECK(RE2::FullMatch(#value, "([0-9a-fA-F]+)[uUlL]*", RE2::Hex(&v))); \ in TEST()
30 CHECK(RE2::FullMatch("0x" #value, "([0-9a-fA-FxX]+)[uUlL]*", RE2::CRadix(&v))); \ in TEST()
46 TEST(RE2, OctalTests) { in TEST() argument
52 CHECK(RE2::FullMatch(#value, "([0-7]+)[uUlL]*", RE2::Octal(&v))); \ in TEST()
54 CHECK(RE2::FullMatch("0" #value, "([0-9a-fA-FxX]+)[uUlL]*", RE2::CRadix(&v))); \ in TEST()
70 TEST(RE2, DecimalTests) { in TEST() argument
76 CHECK(RE2::FullMatch(#value, "(-?[0-9]+)[uUlL]*", &v)); \ in TEST()
78 CHECK(RE2::FullMatch(#value, "(-?[0-9a-fA-FxX]+)[uUlL]*", RE2::CRadix(&v))); \ in TEST()
94 TEST(RE2, Replace) { in TEST() argument
179 CHECK(RE2::Replace(&one, t->regexp, t->rewrite)); in TEST()
182 CHECK_EQ(RE2::GlobalReplace(&all, t->regexp, t->rewrite), t->greplace_count) in TEST()
191 RE2 exp(regexp); in TestCheckRewriteString()
212 TEST(RE2, Extract) { in TEST() argument
217 CHECK(RE2::Extract("boris@kremvax.ru", "(.*)@([^.]*)", "\\2!\\1", &s)); in TEST()
220 CHECK(RE2::Extract("foo", ".*", "'\\0'", &s)); in TEST()
223 CHECK(!RE2::Extract("baz", "bar", "'\\0'", &s)); in TEST()
227 TEST(RE2, Consume) { in TEST() argument
230 RE2 r("\\s*(\\w+)"); // matches a word, possibly proceeded by whitespace in TEST()
236 CHECK(RE2::Consume(&input, r, &word)); in TEST()
238 CHECK(RE2::Consume(&input, r, &word)); in TEST()
240 CHECK(! RE2::Consume(&input, r, &word)) << " input: " << input; in TEST()
243 TEST(RE2, ConsumeN) { in TEST() argument
247 RE2::Arg argv[2]; in TEST()
248 const RE2::Arg* const args[2] = { &argv[0], &argv[1] }; in TEST()
251 EXPECT_TRUE(RE2::ConsumeN(&input, "\\s*(\\w+)", args, 0)); // Skips "one". in TEST()
256 EXPECT_TRUE(RE2::ConsumeN(&input, "\\s*(\\w+)", args, 1)); in TEST()
262 EXPECT_TRUE(RE2::ConsumeN(&input, "\\s*(\\w+)\\s*(\\d+)", args, 2)); in TEST()
267 TEST(RE2, FindAndConsume) { in TEST() argument
270 RE2 r("(\\w+)"); // matches a word in TEST()
276 CHECK(RE2::FindAndConsume(&input, r, &word)); in TEST()
278 CHECK(RE2::FindAndConsume(&input, r, &word)); in TEST()
280 CHECK(RE2::FindAndConsume(&input, r, &word)); in TEST()
282 CHECK(! RE2::FindAndConsume(&input, r, &word)); in TEST()
288 CHECK(RE2::FindAndConsume(&input, "aaa")); in TEST()
292 TEST(RE2, FindAndConsumeN) { in TEST() argument
296 RE2::Arg argv[2]; in TEST()
297 const RE2::Arg* const args[2] = { &argv[0], &argv[1] }; in TEST()
300 EXPECT_TRUE(RE2::FindAndConsumeN(&input, "(\\w+)", args, 0)); // Skips "one". in TEST()
305 EXPECT_TRUE(RE2::FindAndConsumeN(&input, "(\\w+)", args, 1)); in TEST()
311 EXPECT_TRUE(RE2::FindAndConsumeN(&input, "(\\w+)\\s*(\\d+)", args, 2)); in TEST()
316 TEST(RE2, MatchNumberPeculiarity) { in TEST() argument
319 RE2 r("(foo)|(bar)|(baz)"); in TEST()
324 CHECK(RE2::PartialMatch("foo", r, &word1, &word2, &word3)); in TEST()
328 CHECK(RE2::PartialMatch("bar", r, &word1, &word2, &word3)); in TEST()
332 CHECK(RE2::PartialMatch("baz", r, &word1, &word2, &word3)); in TEST()
336 CHECK(!RE2::PartialMatch("f", r, &word1, &word2, &word3)); in TEST()
339 CHECK(RE2::FullMatch("hello", "(foo)|hello", &a)); in TEST()
343 TEST(RE2, Match) { in TEST() argument
344 RE2 re("((\\w+):([0-9]+))"); // extracts host and port in TEST()
349 CHECK(!re.Match(s, 0, s.size(), RE2::UNANCHORED, in TEST()
354 CHECK(re.Match(s, 0, s.size(), RE2::UNANCHORED, in TEST()
363 CHECK(RE2::PartialMatch("a chrisr:9000 here", re, &all, &host, &port)); in TEST()
378 RE2 re("([a-zA-Z0-9]|-)+(\\.([a-zA-Z0-9]|-)+)*(\\.)?", RE2::Quiet); in TestRecursion()
379 RE2::FullMatch(domain, re); in TestRecursion()
385 const RE2::Options& options = RE2::DefaultOptions) { in TestQuoteMeta()
386 string quoted = RE2::QuoteMeta(unquoted); in TestQuoteMeta()
387 RE2 re(quoted, options); in TestQuoteMeta()
388 EXPECT_TRUE_M(RE2::FullMatch(unquoted, re), in TestQuoteMeta()
395 const RE2::Options& options = RE2::DefaultOptions) { in NegativeTestQuoteMeta()
396 string quoted = RE2::QuoteMeta(unquoted); in NegativeTestQuoteMeta()
397 RE2 re(quoted, options); in NegativeTestQuoteMeta()
398 EXPECT_FALSE_M(RE2::FullMatch(should_not_match, re), in NegativeTestQuoteMeta()
432 TestQuoteMeta("3\xb2 = 9", RE2::Latin1); in TEST()
463 RE2 re_simple("simple regexp"); in TEST()
464 RE2 re_medium("medium.*regexp"); in TEST()
465 RE2 re_complex("hard.{1,128}regexp"); in TEST()
483 CHECK(!RE2(empties[i]).Match("abc", 0, 3, RE2::UNANCHORED, NULL, 0)); in TEST()
489 RE2 re("(hello world)"); in TEST()
496 RE2 re("(?P<A>expr(?P<B>expr)(?P<C>expr))((expr)(?P<D>expr))"); in TEST()
507 TEST(RE2, FullMatchWithNoArgs) { in TEST() argument
508 CHECK(RE2::FullMatch("h", "h")); in TEST()
509 CHECK(RE2::FullMatch("hello", "hello")); in TEST()
510 CHECK(RE2::FullMatch("hello", "h.*o")); in TEST()
511 CHECK(!RE2::FullMatch("othello", "h.*o")); // Must be anchored at front in TEST()
512 CHECK(!RE2::FullMatch("hello!", "h.*o")); // Must be anchored at end in TEST()
515 TEST(RE2, PartialMatch) { in TEST() argument
516 CHECK(RE2::PartialMatch("x", "x")); in TEST()
517 CHECK(RE2::PartialMatch("hello", "h.*o")); in TEST()
518 CHECK(RE2::PartialMatch("othello", "h.*o")); in TEST()
519 CHECK(RE2::PartialMatch("hello!", "h.*o")); in TEST()
520 CHECK(RE2::PartialMatch("x", "((((((((((((((((((((x))))))))))))))))))))")); in TEST()
523 TEST(RE2, PartialMatchN) { in TEST() argument
524 RE2::Arg argv[2]; in TEST()
525 const RE2::Arg* const args[2] = { &argv[0], &argv[1] }; in TEST()
528 EXPECT_TRUE(RE2::PartialMatchN("hello", "e.*o", args, 0)); in TEST()
529 EXPECT_FALSE(RE2::PartialMatchN("othello", "a.*o", args, 0)); in TEST()
534 EXPECT_TRUE(RE2::PartialMatchN("1001 nights", "(\\d+)", args, 1)); in TEST()
536 EXPECT_FALSE(RE2::PartialMatchN("three", "(\\d+)", args, 1)); in TEST()
541 EXPECT_TRUE(RE2::PartialMatchN("answer: 42:life", "(\\d+):(\\w+)", args, 2)); in TEST()
544 EXPECT_FALSE(RE2::PartialMatchN("hi1", "(\\w+)(1)", args, 2)); in TEST()
547 TEST(RE2, FullMatchZeroArg) { in TEST() argument
549 CHECK(RE2::FullMatch("1001", "\\d+")); in TEST()
552 TEST(RE2, FullMatchOneArg) { in TEST() argument
556 CHECK(RE2::FullMatch("1001", "(\\d+)", &i)); in TEST()
558 CHECK(RE2::FullMatch("-123", "(-?\\d+)", &i)); in TEST()
560 CHECK(!RE2::FullMatch("10", "()\\d+", &i)); in TEST()
561 CHECK(!RE2::FullMatch("1234567890123456789012345678901234567890", in TEST()
565 TEST(RE2, FullMatchIntegerArg) { in TEST() argument
569 CHECK(RE2::FullMatch("1234", "1(\\d*)4", &i)); in TEST()
571 CHECK(RE2::FullMatch("1234", "(\\d)\\d+", &i)); in TEST()
573 CHECK(RE2::FullMatch("-1234", "(-\\d)\\d+", &i)); in TEST()
575 CHECK(RE2::PartialMatch("1234", "(\\d)", &i)); in TEST()
577 CHECK(RE2::PartialMatch("-1234", "(-\\d)", &i)); in TEST()
581 TEST(RE2, FullMatchStringArg) { in TEST() argument
584 CHECK(RE2::FullMatch("hello", "h(.*)o", &s)); in TEST()
588 TEST(RE2, FullMatchStringPieceArg) { in TEST() argument
592 CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &sp, &i)); in TEST()
598 TEST(RE2, FullMatchMultiArg) { in TEST() argument
602 CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i)); in TEST()
607 TEST(RE2, FullMatchN) { in TEST() argument
608 RE2::Arg argv[2]; in TEST()
609 const RE2::Arg* const args[2] = { &argv[0], &argv[1] }; in TEST()
612 EXPECT_TRUE(RE2::FullMatchN("hello", "h.*o", args, 0)); in TEST()
613 EXPECT_FALSE(RE2::FullMatchN("othello", "h.*o", args, 0)); in TEST()
618 EXPECT_TRUE(RE2::FullMatchN("1001", "(\\d+)", args, 1)); in TEST()
620 EXPECT_FALSE(RE2::FullMatchN("three", "(\\d+)", args, 1)); in TEST()
625 EXPECT_TRUE(RE2::FullMatchN("42:life", "(\\d+):(\\w+)", args, 2)); in TEST()
628 EXPECT_FALSE(RE2::FullMatchN("hi1", "(\\w+)(1)", args, 2)); in TEST()
631 TEST(RE2, FullMatchIgnoredArg) { in TEST() argument
635 CHECK(RE2::FullMatch("ruby:1234", "(\\w+)(:)(\\d+)", &s, (void*)NULL, &i)); in TEST()
640 TEST(RE2, FullMatchTypedNullArg) { in TEST() argument
644 CHECK(RE2::FullMatch("hello", "he(.*)lo", (char*)NULL)); in TEST()
645 CHECK(RE2::FullMatch("hello", "h(.*)o", (string*)NULL)); in TEST()
646 CHECK(RE2::FullMatch("hello", "h(.*)o", (StringPiece*)NULL)); in TEST()
647 CHECK(RE2::FullMatch("1234", "(.*)", (int*)NULL)); in TEST()
648 CHECK(RE2::FullMatch("1234567890123456", "(.*)", (long long*)NULL)); in TEST()
649 CHECK(RE2::FullMatch("123.4567890123456", "(.*)", (double*)NULL)); in TEST()
650 CHECK(RE2::FullMatch("123.4567890123456", "(.*)", (float*)NULL)); in TEST()
653 CHECK(!RE2::FullMatch("hello", "h(.*)lo", &s, (char*)NULL)); in TEST()
654 CHECK(!RE2::FullMatch("hello", "(.*)", (int*)NULL)); in TEST()
655 CHECK(!RE2::FullMatch("1234567890123456", "(.*)", (int*)NULL)); in TEST()
656 CHECK(!RE2::FullMatch("hello", "(.*)", (double*)NULL)); in TEST()
657 CHECK(!RE2::FullMatch("hello", "(.*)", (float*)NULL)); in TEST()
662 TEST(RE2, NULTerminated) { in TEST() argument
678 CHECK(RE2::FullMatch(StringPiece(v + pagesize - 1, 1), "(.*)", &x)); in TEST()
682 TEST(RE2, FullMatchTypeTests) { in TEST() argument
687 CHECK(RE2::FullMatch("Hello", "(H)ello", &c)); in TEST()
692 CHECK(RE2::FullMatch("Hello", "(H)ello", &c)); in TEST()
697 CHECK(RE2::FullMatch("100", "(-?\\d+)", &v)); CHECK_EQ(v, 100); in TEST()
698 CHECK(RE2::FullMatch("-100", "(-?\\d+)", &v)); CHECK_EQ(v, -100); in TEST()
699 CHECK(RE2::FullMatch("32767", "(-?\\d+)", &v)); CHECK_EQ(v, 32767); in TEST()
700 CHECK(RE2::FullMatch("-32768", "(-?\\d+)", &v)); CHECK_EQ(v, -32768); in TEST()
701 CHECK(!RE2::FullMatch("-32769", "(-?\\d+)", &v)); in TEST()
702 CHECK(!RE2::FullMatch("32768", "(-?\\d+)", &v)); in TEST()
706 CHECK(RE2::FullMatch("100", "(\\d+)", &v)); CHECK_EQ(v, 100); in TEST()
707 CHECK(RE2::FullMatch("32767", "(\\d+)", &v)); CHECK_EQ(v, 32767); in TEST()
708 CHECK(RE2::FullMatch("65535", "(\\d+)", &v)); CHECK_EQ(v, 65535); in TEST()
709 CHECK(!RE2::FullMatch("65536", "(\\d+)", &v)); in TEST()
715 CHECK(RE2::FullMatch("100", "(-?\\d+)", &v)); CHECK_EQ(v, 100); in TEST()
716 CHECK(RE2::FullMatch("-100", "(-?\\d+)", &v)); CHECK_EQ(v, -100); in TEST()
717 CHECK(RE2::FullMatch("2147483647", "(-?\\d+)", &v)); CHECK_EQ(v, max); in TEST()
718 CHECK(RE2::FullMatch("-2147483648", "(-?\\d+)", &v)); CHECK_EQ(v, min); in TEST()
719 CHECK(!RE2::FullMatch("-2147483649", "(-?\\d+)", &v)); in TEST()
720 CHECK(!RE2::FullMatch("2147483648", "(-?\\d+)", &v)); in TEST()
722 CHECK(RE2::FullMatch(zeros + "2147483647", "(-?\\d+)", &v)); in TEST()
724 CHECK(RE2::FullMatch("-" + zeros + "2147483648", "(-?\\d+)", &v)); in TEST()
727 CHECK(!RE2::FullMatch("-" + zeros + "2147483649", "(-?\\d+)", &v)); in TEST()
728 CHECK(RE2::FullMatch("0x7fffffff", "(.*)", RE2::CRadix(&v))); in TEST()
730 CHECK(!RE2::FullMatch("000x7fffffff", "(.*)", RE2::CRadix(&v))); in TEST()
735 CHECK(RE2::FullMatch("100", "(\\d+)", &v)); CHECK_EQ(v, 100); in TEST()
736 CHECK(RE2::FullMatch("4294967295", "(\\d+)", &v)); CHECK_EQ(v, max); in TEST()
737 CHECK(!RE2::FullMatch("4294967296", "(\\d+)", &v)); in TEST()
738 CHECK(!RE2::FullMatch("-1", "(\\d+)", &v)); in TEST()
740 CHECK(RE2::FullMatch(zeros + "4294967295", "(\\d+)", &v)); CHECK_EQ(v, max); in TEST()
748 CHECK(RE2::FullMatch("100", "(-?\\d+)", &v)); CHECK_EQ(v, 100); in TEST()
749 CHECK(RE2::FullMatch("-100", "(-?\\d+)", &v)); CHECK_EQ(v, -100); in TEST()
752 CHECK(RE2::FullMatch(buf, "(-?\\d+)", &v)); CHECK_EQ(v, max); in TEST()
755 CHECK(RE2::FullMatch(buf, "(-?\\d+)", &v)); CHECK_EQ(v, min); in TEST()
760 CHECK(!RE2::FullMatch(buf, "(-?\\d+)", &v)); in TEST()
765 CHECK(!RE2::FullMatch(buf, "(-?\\d+)", &v)); in TEST()
773 CHECK(RE2::FullMatch("100", "(-?\\d+)", &v)); CHECK_EQ(v, 100); in TEST()
774 CHECK(RE2::FullMatch("-100", "(-?\\d+)", &v2)); CHECK_EQ(v2, -100); in TEST()
777 CHECK(RE2::FullMatch(buf, "(-?\\d+)", &v)); CHECK_EQ(v, max); in TEST()
781 CHECK(!RE2::FullMatch(buf, "(-?\\d+)", &v)); in TEST()
785 TEST(RE2, FloatingPointFullMatchTypes) { in TEST() argument
789 CHECK(RE2::FullMatch("100", "(.*)", &v)); CHECK_EQ(v, 100); in TEST()
790 CHECK(RE2::FullMatch("-100.", "(.*)", &v)); CHECK_EQ(v, -100); in TEST()
791 CHECK(RE2::FullMatch("1e23", "(.*)", &v)); CHECK_EQ(v, float(1e23)); in TEST()
793 CHECK(RE2::FullMatch(zeros + "1e23", "(.*)", &v)); in TEST()
808 CHECK(RE2::FullMatch("0.1", "(.*)", &v)); in TEST()
810 CHECK(RE2::FullMatch("6700000000081920.1", "(.*)", &v)); in TEST()
816 CHECK(RE2::FullMatch("100", "(.*)", &v)); CHECK_EQ(v, 100); in TEST()
817 CHECK(RE2::FullMatch("-100.", "(.*)", &v)); CHECK_EQ(v, -100); in TEST()
818 CHECK(RE2::FullMatch("1e23", "(.*)", &v)); CHECK_EQ(v, 1e23); in TEST()
819 CHECK(RE2::FullMatch(zeros + "1e23", "(.*)", &v)); in TEST()
822 CHECK(RE2::FullMatch("0.1", "(.*)", &v)); in TEST()
824 CHECK(RE2::FullMatch("1.00000005960464485", "(.*)", &v)); in TEST()
830 TEST(RE2, FullMatchAnchored) { in TEST() argument
833 CHECK(!RE2::FullMatch("x1001", "(\\d+)", &i)); in TEST()
834 CHECK(!RE2::FullMatch("1001x", "(\\d+)", &i)); in TEST()
835 CHECK(RE2::FullMatch("x1001", "x(\\d+)", &i)); CHECK_EQ(i, 1001); in TEST()
836 CHECK(RE2::FullMatch("1001x", "(\\d+)x", &i)); CHECK_EQ(i, 1001); in TEST()
839 TEST(RE2, FullMatchBraces) { in TEST() argument
841 CHECK(RE2::FullMatch("0abcd", "[0-9a-f+.-]{5,}")); in TEST()
842 CHECK(RE2::FullMatch("0abcde", "[0-9a-f+.-]{5,}")); in TEST()
843 CHECK(!RE2::FullMatch("0abc", "[0-9a-f+.-]{5,}")); in TEST()
846 TEST(RE2, Complicated) { in TEST() argument
848 CHECK(RE2::FullMatch("foo", "foo|bar|[A-Z]")); in TEST()
849 CHECK(RE2::FullMatch("bar", "foo|bar|[A-Z]")); in TEST()
850 CHECK(RE2::FullMatch("X", "foo|bar|[A-Z]")); in TEST()
851 CHECK(!RE2::FullMatch("XY", "foo|bar|[A-Z]")); in TEST()
854 TEST(RE2, FullMatchEnd) { in TEST() argument
856 CHECK(RE2::FullMatch("fo", "fo|foo")); in TEST()
857 CHECK(RE2::FullMatch("foo", "fo|foo")); in TEST()
858 CHECK(RE2::FullMatch("fo", "fo|foo$")); in TEST()
859 CHECK(RE2::FullMatch("foo", "fo|foo$")); in TEST()
860 CHECK(RE2::FullMatch("foo", "foo$")); in TEST()
861 CHECK(!RE2::FullMatch("foo$bar", "foo\\$")); in TEST()
862 CHECK(!RE2::FullMatch("fox", "fo|bar")); in TEST()
869 CHECK(!RE2::PartialMatch("foo\n", "foo$")); in TEST()
873 TEST(RE2, FullMatchArgCount) { in TEST() argument
876 CHECK(RE2::FullMatch("", "")); in TEST()
879 CHECK(RE2::FullMatch("1", in TEST()
885 CHECK(RE2::FullMatch("12", in TEST()
892 CHECK(RE2::FullMatch("123", in TEST()
900 CHECK(RE2::FullMatch("1234", in TEST()
909 CHECK(RE2::FullMatch("12345", in TEST()
920 CHECK(RE2::FullMatch("123456", in TEST()
932 CHECK(RE2::FullMatch("1234567", in TEST()
945 CHECK(RE2::FullMatch("1234567890123456", in TEST()
970 TEST(RE2, Accessors) { in TEST() argument
974 const RE2 re(kPattern); in TEST()
980 RE2 re("foo"); in TEST()
983 CHECK(re.error_code() == RE2::NoError); in TEST()
987 TEST(RE2, UTF8) { in TEST() argument
1004 RE2 re_test1(".........", RE2::Latin1); in TEST()
1005 CHECK(RE2::FullMatch(utf8_string, re_test1)); in TEST()
1006 RE2 re_test2("..."); in TEST()
1007 CHECK(RE2::FullMatch(utf8_string, re_test2)); in TEST()
1012 RE2 re_test3("(.)", RE2::Latin1); in TEST()
1013 CHECK(RE2::PartialMatch(utf8_string, re_test3, &s)); in TEST()
1015 RE2 re_test4("(.)"); in TEST()
1016 CHECK(RE2::PartialMatch(utf8_string, re_test4, &s)); in TEST()
1020 RE2 re_test5(utf8_string, RE2::Latin1); in TEST()
1021 CHECK(RE2::FullMatch(utf8_string, re_test5)); in TEST()
1022 RE2 re_test6(utf8_string); in TEST()
1023 CHECK(RE2::FullMatch(utf8_string, re_test6)); in TEST()
1026 RE2 re_test7(utf8_pattern, RE2::Latin1); in TEST()
1027 CHECK(!RE2::FullMatch(utf8_string, re_test7)); in TEST()
1028 RE2 re_test8(utf8_pattern); in TEST()
1029 CHECK(RE2::FullMatch(utf8_string, re_test8)); in TEST()
1032 TEST(RE2, UngreedyUTF8) { in TEST() argument
1039 RE2 match_sentence(pattern, RE2::Latin1); in TEST()
1040 RE2 match_sentence_re(pattern); in TEST()
1042 CHECK(!RE2::FullMatch(target, match_sentence)); in TEST()
1043 CHECK(!RE2::FullMatch(target, match_sentence_re)); in TEST()
1048 RE2 match_sentence(pattern, RE2::Latin1); in TEST()
1050 RE2 match_sentence_re(pattern); in TEST()
1052 CHECK(!RE2::FullMatch(target, match_sentence)); in TEST()
1053 CHECK(!RE2::FullMatch(target, match_sentence_re)); in TEST()
1057 TEST(RE2, Rejects) { in TEST() argument
1058 { RE2 re("a\\1", RE2::Quiet); CHECK(!re.ok()); } in TEST()
1060 RE2 re("a[x", RE2::Quiet); in TEST()
1064 RE2 re("a[z-a]", RE2::Quiet); in TEST()
1068 RE2 re("a[[:foobar:]]", RE2::Quiet); in TEST()
1072 RE2 re("a(b", RE2::Quiet); in TEST()
1076 RE2 re("a\\", RE2::Quiet); in TEST()
1081 TEST(RE2, NoCrash) { in TEST() argument
1084 RE2 re("a\\", RE2::Quiet); in TEST()
1086 CHECK(!RE2::PartialMatch("a\\b", re)); in TEST()
1091 RE2 re("(((.{100}){100}){100}){100}", RE2::Quiet); in TEST()
1093 CHECK(!RE2::PartialMatch("aaa", re)); in TEST()
1098 RE2 re(".{512}x", RE2::Quiet); in TEST()
1103 CHECK(RE2::PartialMatch(s, re)); in TEST()
1107 TEST(RE2, Recursion) { in TEST() argument
1118 TEST(RE2, BigCountedRepetition) { in TEST() argument
1120 RE2::Options opt; in TEST()
1123 RE2 re(".{512}x", opt); in TEST()
1128 CHECK(RE2::PartialMatch(s, re)); in TEST()
1131 TEST(RE2, DeepRecursion) { in TEST() argument
1140 RE2 re("((?:\\s|xx.*\n|x[*](?:\n|.)*?[*]x)*)"); in TEST()
1141 CHECK(RE2::FullMatch(comment, re)); in TEST()
1151 EXPECT_TRUE(RE2::PartialMatch(sp, "(?i)([wand]{5})", &result)); in TEST()
1152 EXPECT_TRUE(RE2::FindAndConsume(&sp, "(?i)([wand]{5})", &result)); in TEST()
1157 TEST(RE2, ImplicitConversions) { in TEST() argument
1161 EXPECT_TRUE(RE2::PartialMatch("e", re_string)); in TEST()
1162 EXPECT_TRUE(RE2::PartialMatch("e", re_stringpiece)); in TEST()
1163 EXPECT_TRUE(RE2::PartialMatch("e", re_cstring)); in TEST()
1164 EXPECT_TRUE(RE2::PartialMatch("e", ".")); in TEST()
1168 TEST(RE2, CL8622304) { in TEST() argument
1171 EXPECT_TRUE(RE2::FullMatch("D", "([^\\\\])")); // ok in TEST()
1172 EXPECT_TRUE(RE2::FullMatch("D", "([^\\\\])", &dir)); // fails in TEST()
1176 EXPECT_TRUE(RE2::PartialMatch("bar:1,0x2F,030,4,5;baz:true;fooby:false,true", in TEST()
1211 TEST(RE2, ErrorArgs) { in TEST() argument
1213 RE2 re(error_tests[i].regexp, RE2::Quiet); in TEST()
1231 TEST(RE2, NeverNewline) { in TEST() argument
1232 RE2::Options opt; in TEST()
1236 RE2 re(t.regexp, opt); in TEST()
1248 TEST(RE2, NeverCapture) { in TEST() argument
1249 RE2::Options opt; in TEST()
1251 RE2 re("(r)(e)", opt); in TEST()
1259 TEST(RE2, BitstateCaptureBug) { in TEST() argument
1260 RE2::Options opt; in TEST()
1262 RE2 re("(_________$)", opt); in TEST()
1264 EXPECT_FALSE(re.Match(s, 0, s.size(), RE2::UNANCHORED, NULL, 0)); in TEST()
1268 TEST(RE2, UnicodeClasses) { in TEST() argument
1272 EXPECT_TRUE(RE2::FullMatch("A", "\\p{L}")); in TEST()
1273 EXPECT_TRUE(RE2::FullMatch("A", "\\p{Lu}")); in TEST()
1274 EXPECT_FALSE(RE2::FullMatch("A", "\\p{Ll}")); in TEST()
1275 EXPECT_FALSE(RE2::FullMatch("A", "\\P{L}")); in TEST()
1276 EXPECT_FALSE(RE2::FullMatch("A", "\\P{Lu}")); in TEST()
1277 EXPECT_TRUE(RE2::FullMatch("A", "\\P{Ll}")); in TEST()
1279 EXPECT_TRUE(RE2::FullMatch("譚", "\\p{L}")); in TEST()
1280 EXPECT_FALSE(RE2::FullMatch("譚", "\\p{Lu}")); in TEST()
1281 EXPECT_FALSE(RE2::FullMatch("譚", "\\p{Ll}")); in TEST()
1282 EXPECT_FALSE(RE2::FullMatch("譚", "\\P{L}")); in TEST()
1283 EXPECT_TRUE(RE2::FullMatch("譚", "\\P{Lu}")); in TEST()
1284 EXPECT_TRUE(RE2::FullMatch("譚", "\\P{Ll}")); in TEST()
1286 EXPECT_TRUE(RE2::FullMatch("永", "\\p{L}")); in TEST()
1287 EXPECT_FALSE(RE2::FullMatch("永", "\\p{Lu}")); in TEST()
1288 EXPECT_FALSE(RE2::FullMatch("永", "\\p{Ll}")); in TEST()
1289 EXPECT_FALSE(RE2::FullMatch("永", "\\P{L}")); in TEST()
1290 EXPECT_TRUE(RE2::FullMatch("永", "\\P{Lu}")); in TEST()
1291 EXPECT_TRUE(RE2::FullMatch("永", "\\P{Ll}")); in TEST()
1293 EXPECT_TRUE(RE2::FullMatch("鋒", "\\p{L}")); in TEST()
1294 EXPECT_FALSE(RE2::FullMatch("鋒", "\\p{Lu}")); in TEST()
1295 EXPECT_FALSE(RE2::FullMatch("鋒", "\\p{Ll}")); in TEST()
1296 EXPECT_FALSE(RE2::FullMatch("鋒", "\\P{L}")); in TEST()
1297 EXPECT_TRUE(RE2::FullMatch("鋒", "\\P{Lu}")); in TEST()
1298 EXPECT_TRUE(RE2::FullMatch("鋒", "\\P{Ll}")); in TEST()
1300 EXPECT_TRUE(RE2::PartialMatch(str, "(.).*?(.).*?(.)", &a, &b, &c)); in TEST()
1305 EXPECT_TRUE(RE2::PartialMatch(str, "(.).*?([\\p{L}]).*?(.)", &a, &b, &c)); in TEST()
1310 EXPECT_FALSE(RE2::PartialMatch(str, "\\P{L}")); in TEST()
1312 EXPECT_TRUE(RE2::PartialMatch(str, "(.).*?([\\p{Lu}]).*?(.)", &a, &b, &c)); in TEST()
1317 EXPECT_FALSE(RE2::PartialMatch(str, "[^\\p{Lu}\\p{Lo}]")); in TEST()
1319 EXPECT_TRUE(RE2::PartialMatch(str, ".*(.).*?([\\p{Lu}\\p{Lo}]).*?(.)", &a, &b, &c)); in TEST()
1326 TEST(RE2, NullVsEmptyString) { in TEST() argument
1327 RE2 re2(".*"); in TEST()
1329 EXPECT_TRUE(RE2::FullMatch(v1, re2)); in TEST()
1332 EXPECT_TRUE(RE2::FullMatch(v2, re2)); in TEST()
1336 TEST(RE2, Bug1816809) { in TEST() argument
1337 RE2 re("(((((llx((-3)|(4)))(;(llx((-3)|(4))))*))))"); in TEST()
1340 EXPECT_TRUE(RE2::Consume(&piece, re, &x)); in TEST()
1344 TEST(RE2, Bug3061120) { in TEST() argument
1345 RE2 re("(?i)\\W"); in TEST()
1346 EXPECT_FALSE(RE2::PartialMatch("x", re)); // always worked in TEST()
1347 EXPECT_FALSE(RE2::PartialMatch("k", re)); // broke because of kelvin in TEST()
1348 EXPECT_FALSE(RE2::PartialMatch("s", re)); // broke because of latin long s in TEST()
1351 TEST(RE2, CapturingGroupNames) { in TEST() argument
1354 RE2 re("((abc)(?P<G2>)|((e+)(?P<G2>.*)(?P<G1>u+)))"); in TEST()
1364 TEST(RE2, RegexpToStringLossOfAnchor) { in TEST() argument
1365 EXPECT_EQ(RE2("^[a-c]at", RE2::POSIX).Regexp()->ToString(), "^[a-c]at"); in TEST()
1366 EXPECT_EQ(RE2("^[a-c]at").Regexp()->ToString(), "(?-m:^)[a-c]at"); in TEST()
1367 EXPECT_EQ(RE2("ca[t-z]$", RE2::POSIX).Regexp()->ToString(), "ca[t-z]$"); in TEST()
1368 EXPECT_EQ(RE2("ca[t-z]$").Regexp()->ToString(), "ca[t-z](?-m:$)"); in TEST()