Regex String Generator
Generate random strings that match a regular expression, such as order numbers, codes or hostnames, and check each one against the pattern.
Free · No sign-up · Your inputs stay in your browser
Input
Generate strings that match a regex
Output
Press Generate
Supports literals, character classes and ranges, \d \w \s and their negations, ., groups, alternation and the quantifiers * + ? {n} {n,m}. Unbounded quantifiers are capped at a few repeats so the output stays readable. Each result is checked against the pattern with the browser's own regex engine; lookarounds and backreferences are ignored when generating, so a pattern relying on them may produce strings that fail the check, and the count says how many.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Test data in the shape you need
Fixtures need ids that look like production ones, fuzz tests need many valid inputs, and validation rules need examples on both sides of the line. Writing the format once as a regex and generating from it keeps the data and the rule in sync. Libraries such as randexp in JavaScript and Hypothesis's from_regex in Python do this in code.
Limits
Lookaheads, lookbehinds and backreferences cannot be generated forwards and are ignored, so a pattern that depends on them may produce non-matching strings; the check reports how many.