1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

LibRegex: Consider the inverse=true case when finding pattern overlap

Previously we were only checking for overlap when the range wasn't in
inverse mode, which made us miss things like /[^x]x/; this patch makes
it so we don't miss that.
This commit is contained in:
Ali Mohammad Pur 2023-02-15 10:12:03 +03:30 committed by Andreas Kling
parent 936a9fd759
commit af441bb939
2 changed files with 5 additions and 3 deletions

View file

@ -984,6 +984,8 @@ TEST_CASE(optimizer_atomic_groups)
Tuple { "(1+)0"sv, "10"sv, true },
// Rewrite should not skip over first required iteration of <x>+.
Tuple { "a+"sv, ""sv, false },
// 'y' and [^x] have an overlap ('y'), the loop should not be rewritten here.
Tuple { "[^x]+y"sv, "ay"sv, true },
};
for (auto& test : tests) {