diff --git a/re2/re2.cc b/re2/re2.cc index f17d772fdf72c8d904b8dfc1150dd4ce53607f82..1a60d0930d65a2f451779858b2f44cadccead1dc 100644 --- a/re2/re2.cc +++ b/re2/re2.cc @@ -199,7 +199,11 @@ namespace re2 uint32_t flags = RURE_DEFAULT_FLAGS; if(options_.dot_nl()) flags = RURE_FLAG_DOTNL; - if(options_.never_nl()) flags = RURE_DEFAULT_FLAGS; + // if(options_.never_nl()) flags = RURE_DEFAULT_FLAGS; + if(options_.encoding() == RE2::Options::EncodingLatin1){ + flags |= RURE_FLAG_UNICODE; + } + // for All rure *re = rure_compile((const uint8_t *)rure_str.c_str(), strlen(rure_str.c_str()), flags, NULL, err); //这里应该被注释,如果rure_str为空,re会为空,会去执行if(re == NULL)判断,从而对空的正则表达式进行处理 diff --git a/re2/testing/re2_test.cc b/re2/testing/re2_test.cc index b4b57cc3e797239cd6d4b13eae87e16560b26666..b8e9a7eb34209238366cb9b83696bb7a3d37c24d 100644 --- a/re2/testing/re2_test.cc +++ b/re2/testing/re2_test.cc @@ -1556,7 +1556,6 @@ TEST(RE2, Bug10131674) { EXPECT_FALSE(RE2::FullMatch("hello world", re)); } -/*待处理的 TEST(RE2, Bug18391750) { // Stray write past end of match_ in nfa.cc, caught by fuzzing + address sanitizer. const char t[] = { @@ -1576,7 +1575,6 @@ TEST(RE2, Bug18391750) { ASSERT_TRUE(re.ok()); RE2::PartialMatch(t, re); } -*/ TEST(RE2, Bug18458852) { // Bug in parser accepting invalid (too large) rune,