diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 2e3b9ccf..6673695d 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -1067,13 +1067,13 @@ auto test_regex = UnitTest{[]{ } { - TestVM<> vm{R"((?!foo)...)"}; + TestVM<> vm{R"((?!f[oa]o)...)"}; kak_assert(not vm.exec("foo")); kak_assert(vm.exec("qux")); } { - TestVM<> vm{R"(...(?<=foo))"}; + TestVM<> vm{R"(...(?<=f.o))"}; kak_assert(vm.exec("foo")); kak_assert(not vm.exec("qux")); } diff --git a/src/regex_impl.hh b/src/regex_impl.hh index cb5a53be..d18de8a1 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -388,8 +388,11 @@ private: auto cp = (look_direction == MatchDirection::Forward ? *pos : *(pos-1)), ref = *it; if (ref == 0xF000) {} // any character matches - else if (ref > 0xF0000 and ref <= 0xFFFFD and not m_program.matchers[ref - 0xF0001](cp)) - return false; + else if (ref > 0xF0000 and ref <= 0xFFFFD) + { + if (not m_program.matchers[ref - 0xF0001](cp)) + return false; + } else if (ref != cp) return false;