From e9cf0f23f23d5d683af7dab8843353be6c0ccda3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 7 Feb 2020 07:37:29 +1100 Subject: [PATCH] Fix regex start desc computation for case insensitive ranges Fixes #3345 --- src/regex_impl.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/regex_impl.cc b/src/regex_impl.cc index 7148980b..a4457bcc 100644 --- a/src/regex_impl.cc +++ b/src/regex_impl.cc @@ -952,7 +952,9 @@ private: case ParsedRegex::Class: { auto& character_class = m_parsed_regex.character_classes[node.value]; - if (character_class.ctypes == CharacterType::None and not character_class.negative) + if (character_class.ctypes == CharacterType::None and + not character_class.negative and + not character_class.ignore_case) { for (auto& range : character_class.ranges) { @@ -1440,6 +1442,11 @@ auto test_regex = UnitTest{[]{ kak_assert(vm.exec("FooFOoBb")); } + { + TestVM<> vm{R"((?i)[a-z]+)"}; + kak_assert(vm.exec("ABC")); + } + { TestVM<> vm{R"([^\]]+)"}; kak_assert(not vm.exec("a]c"));