Regex Test String Generator
Stop guessing. Generate boundary-case strings that expose exactly where your regex succeeds or fails.
Regex input and controls
Generated Test Cases
Enter a regex above and click Generate Test Strings.
We'll produce positive, negative, and edge-case strings with explanations.
Why Regex Test Strings Matter
Regular expressions are compact but deceptive. A single misplaced quantifier or unescaped dot can silently accept invalid input or reject valid data. Manually brainstorming test strings is slow and error-prone — most developers only test the happy path.
This tool parses your pattern and systematically builds strings that probe boundaries: empty inputs, minimum-length matches, maximum repetitions, escaped characters, alternation branches, and lookahead/lookbehind constraints. Each result is tagged as positive (should match), negative (should not match), or edge (boundary behavior worth inspecting).
Use it during development to catch regressions, during code review to validate assumptions, or when writing unit tests to ensure your validation logic handles the unexpected.
How the Generator Works
Parse the pattern
The tool tokenizes your regex into literal characters, character classes, quantifiers, groups, anchors, and lookarounds.
Build candidate strings
For each token we generate matching strings (using representative values) and deliberately broken strings that violate constraints.
Test and categorize
Every candidate is evaluated against your regex with the selected flags. Results are sorted into positive, negative, and edge groups with plain-English explanations.