Regex backtracking checker

A pattern with nested quantifiers can take exponential time on an input that nearly matches — a twenty-character string is enough to pin a CPU. This times yours as the input grows. The matching happens in a worker, so a catastrophic pattern gets terminated instead of freezing this page. How it works.

The test input is the chunk repeated N times plus the suffix — a long valid-looking prefix that cannot match, which is the shape that triggers backtracking.

Structural warning: a quantifier inside a quantified group