From 75608ea223ec952d0927a7773c6cfbfe87fc73a3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 24 Sep 2017 23:23:02 +0900 Subject: [PATCH] Regex: when in full match mode, do not accept trailing data --- src/regex_impl.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 225b83cf..3ad30988 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -695,6 +695,9 @@ struct ThreadedRegexVM const auto res = step(i); if (res == StepResult::Matched) { + if (match) + continue; // We are not at end, this is not a full match + m_captures = std::move(m_threads[i].saves); found_match = true; m_threads.resize(i); // remove this and lower priority threads @@ -768,6 +771,7 @@ auto test_regex = UnitTest{[]{ kak_assert(vm.exec("ab")); kak_assert(vm.exec("aaab")); kak_assert(not vm.exec("acb")); + kak_assert(not vm.exec("abc")); kak_assert(not vm.exec("")); }