Check regular expressions for catastrophic backtracking. Each finding names the construct that causes it and what to write instead.
Waiting for a pattern
One pattern per line. Nothing is compiled or run, so checking a dangerous pattern here is safe.
Paste your patterns
Each line is checked for the shapes that cause nearly all regular expression outages: a repeated group that is itself a repetition, overlapping alternatives, and adjacent repetitions over the same characters.
Regex Backtracking Checker runs entirely on your device — patterns are read as text and never compiled or run, so checking a dangerous one is safe.
You’re on the Free plan. Compare plans
This is static analysis, and it is a different thing from a timeout. A timeout tells you a pattern is already hanging; this tells you a pattern is shaped like one that will, before it reaches a server where nothing stops it. The patterns are read and never run, so checking a dangerous one here is safe.
Three shapes account for nearly every real incident. A repeated group that is itself only a repetition — `(a+)+` — lets the outer repetition divide the same text in exponentially many ways. A repeated group whose alternatives overlap — `(a|ab)+` — gives the engine two ways to finish every iteration. And two adjacent repetitions over sets that share a character — `\\d+\\d+` — give it a choice at every position.
The analysis is deliberately careful about what it does not flag. `(?:-[a-z0-9]+)*`, the shape at the heart of every slug pattern, repeats a group whose body repeats and cannot blow up: each iteration must consume a `-` first, so there is exactly one way to divide any text. Flagging that would make the tool cry wolf on ordinary patterns, and a checker people learn to ignore is worse than none.
It cannot prove a pattern safe, and it says so on every result. Deciding the question in general is not something inspection can do. Where a pattern runs on input you do not control, bound the input length as well.
One pattern per line, because the real question is rarely about one pattern. It is whether any of the forty patterns in a validation file are dangerous, and answering that one at a time is how they get skipped.
Yes. Nothing here compiles or runs a pattern — the analysis reads it as text. That is the whole reason to check statically rather than by trying it.
No, and every result says so. This finds the shapes behind nearly all real incidents; proving a pattern safe in general is not decidable by inspection. Treat a clean result as the absence of a known-bad shape, not a guarantee.
Probably because something at the start of the group pins each iteration to a fixed character. `(?:-[a-z]+)*` has to consume a `-` every time round, so there is only one way to divide the text and no backtracking to do.
No. Lazy changes the order the engine tries the alternatives, not how many there are to try. A lazy outer quantifier is flagged the same way, because the exponential blow-up is unchanged.
Each finding says. Usually it is deleting the outer quantifier, making two character sets disjoint, or beginning a repeated group with a literal the inner repetition cannot match. In PCRE, Java or Ruby an atomic group or possessive quantifier also fixes it; JavaScript has neither.