Regex: Fix handling of non capturing groups (?:...)
We were wrongly keeping the `:` as a literal content of the group
This commit is contained in:
parent
5f6e71c4dc
commit
f1b4931824
|
@ -189,7 +189,10 @@ private:
|
|||
{
|
||||
auto c = advance();
|
||||
if (c == ':')
|
||||
{
|
||||
++m_pos;
|
||||
content = disjunction(-1);
|
||||
}
|
||||
else if (contains("=!<", c))
|
||||
{
|
||||
bool behind = false;
|
||||
|
@ -1005,6 +1008,12 @@ auto test_regex = UnitTest{[]{
|
|||
kak_assert(not vm.exec("a]c"));
|
||||
kak_assert(vm.exec("abc"));
|
||||
}
|
||||
|
||||
{
|
||||
TestVM vm{R"((?:foo)+)"};
|
||||
kak_assert(vm.exec("foofoofoo"));
|
||||
kak_assert(not vm.exec("barbarbar"));
|
||||
}
|
||||
}};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user