diff --git a/Tests/LibRegex/Regex.cpp b/Tests/LibRegex/Regex.cpp index c7d3f5f763917d..07b2b9fae0fd02 100644 --- a/Tests/LibRegex/Regex.cpp +++ b/Tests/LibRegex/Regex.cpp @@ -1033,6 +1033,8 @@ TEST_CASE(optimizer_atomic_groups) // (b+)(b+) produces an intermediate block with no matching ops, the optimiser should ignore that block when looking for following matches and correctly detect the overlap between (b+) and (b+). // note that the second loop may be rewritten to a ForkReplace, but the first loop should not be rewritten. Tuple { "(b+)(b+)"sv, "bbb"sv, true }, + // Don't treat [\S] as [\s]; see ladybird#2296. + Tuple { "([^\\s]+?)\\(([\\s\\S]*)\\)"sv, "a(b)"sv, true }, }; for (auto& test : tests) { diff --git a/Userland/Libraries/LibRegex/RegexOptimizer.cpp b/Userland/Libraries/LibRegex/RegexOptimizer.cpp index c6fd94a2a7665b..a0d7e82703b2fb 100644 --- a/Userland/Libraries/LibRegex/RegexOptimizer.cpp +++ b/Userland/Libraries/LibRegex/RegexOptimizer.cpp @@ -221,7 +221,7 @@ static bool has_overlap(Vector const& lhs, Vector const& lhs, Vector