Zum Inhalt springen
uencoder

Testen ein regular expression vor shipping it

Validieren pattern syntax, inspect every match with capture groups, and learn the backtracking pitfalls that turn a regex into an outage.

  1. 1
    Regex-Tester →

    Enter the pattern (flags optional) and a test input. Every match is listed with its capture groups, so you can see exactly what group 1, 2, ... will contain — including empty matches, which are marked instead of looping forever.

  2. 2

    Test against three classes of input before shipping: the happy path, the empty string (patterns like (.*)* match it in surprising ways), and adversarial input designed against your pattern. Anchors matter: ^ and $ anchor line starts when the m flag is set, otherwise string edges — a pattern that works on a single line can misbehave on multi-line text.

  3. 3

    Backtracking caution: nested quantifiers such as (a+)+ or (\w+\s?)* can explode exponentially on crafted inputs — this is ReDoS, a real availability vulnerability. This tool runs patterns in a worker with a hard timeout, so a pathological pattern fails here instead of freezing your browser, but your production server needs the same guard (or a regex engine with linear-time guarantees like RE2).

  4. 4
    Regex-Ersetzung →

    Once the pattern is proven, preview the substitution ($1 backreferences included) against the same test corpus before wiring it into code.

Häufige Fragen

What is catastrophic backtracking (ReDoS)?
When a pattern allows the same input substring to be matched in multiple ways (nested quantifiers, overlapping alternations), the engine may try exponentially many combinations. An attacker-crafted string can keep a CPU busy for hours — a denial of service from one HTTP parameter.
Why does my match return an empty string?
Patterns where every part is optional (e.g. (a)*) match the empty string at every position. The tool surfaces these so you can add a required component or a length guard.

Workflows, die diese Aufgabe lösen

Verwandte Tools