Files
ladybird/Tests/LibJS/Runtime/regexp-lookbehind-greedy-backtracking.js
Andreas Kling b96872140e LibRegex: Fix backward greedy lookbehind backtracking
When a backward greedy loop backtracked toward the right edge of the
input, the optimized scan for a following Char instruction could stop
making progress at end of input and loop forever. This made patterns
like /(?<=a.?)/ hang on non-matching input.
2026-03-27 17:32:19 +01:00

9 lines
265 B
JavaScript

test("greedy lookbehind backtracking makes progress at end of input", () => {
expect(/(?<=a.?)/.exec("b")).toBeNull();
let match = /(?<=a.?)/.exec("ab");
expect(match).not.toBeNull();
expect(match[0]).toBe("");
expect(match.index).toBe(1);
});