Regex: when in full match mode, do not accept trailing data

This commit is contained in:
Maxime Coste 2017-09-24 23:23:02 +09:00
parent 490c130e41
commit 75608ea223

View File

@ -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(""));
}