Generate Sample Data from a Regex
WebEverything runs locally in your browser — nothing is uploaded
The slow part of writing a regex is rarely the regex itself — it is producing data to test it with. Edge cases like extra subdomains, hyphens and optional groups are easy to miss by hand. This tool builds data from the structure of the pattern, and every sample it returns really matches. There is one hard rule: each sample is verified with a real regex engine as it is generated. If one fails, you get an internal error instead of the data — because a sample that looks right but does not match would mislead you when you test your own pattern. Only the syntax the generator understands is supported (literals, character classes, quantifiers, groups, alternation, `\d \w \s` and their negations). Lookaround, backreferences and named groups report an error rather than quietly producing something wrong. Everything runs in your browser — your pattern and the samples never leave the page.
Features
- One regex per line, several patterns at once
- Supported: literals, `.`, classes `[a-z]` `[^0-9]`, quantifiers `* + ? {n,m}`, groups, alternation `|`, `\d \w \s` and capitals
- Anchors `^ $` are ignored when generating, but samples are still verified by the real engine
- Every sample verified with `new RegExp` before it is shown
- Unsupported syntax (lookaround, backreferences, named groups, `\b`, `\p{…}`) reports an error
- Character set preference: ASCII, digits only, Chinese, or everything with punctuation
- A random seed makes a batch reproducible
- Copy a single sample, or all of them
How to use
- Type one regular expression per line (several are fine)
- Adjust samples per pattern, the total limit, or the character set
- Samples appear in the result area — green means verified
- Set a seed if you want the same batch again
FAQ
- Are the samples guaranteed to match?
- Yes. Every sample is tested again with a real regex engine (`new RegExp`), and only matching ones are returned. The generator builds, the engine verifies — kept separate so the tool never grades its own work.
- Why do some patterns raise an error?
- Lookaround `(?=`, backreferences `\1`, named groups `(?<name>`, word boundaries `\b` and Unicode properties `\p{…}` are not implemented. Rather than guess at data that fails to match, the tool tells you which construct it cannot handle — wrong data would mislead you when testing your pattern.
- What is the random seed for?
- Random data changes every run, which is awkward when writing docs, recording a demo or reproducing a bug with a colleague. A seed gives you a fixed batch — but remember it is pseudo-random and must never be used for passwords or keys.
- Is my data uploaded?
- No. Parsing, generation and verification all happen in your browser. No request is made, and it works offline.
Related tools
Regex Tester
TextTest a regex in the browser: live highlighting, capture groups, replace preview, a backtracking guard — and JavaScript, Python, Java, Go or PHP code.
Regex Code Generator
WebTurn a regular expression into JavaScript, Python, Java, Go, PHP and C# snippets, focused on how many backslashes each language really needs.
Mock Data
GeneratorsDescribe your fields once and get realistic mock records, exportable as JSON, CSV, TSV, SQL, XML, YAML or TOML. All generated in your browser.
URL Parser
WebParse a URL into scheme, host, port, path, query parameters and fragment, with each parameter shown raw and decoded. Runs entirely in your browser.
User-Agent Parser
WebParse a user agent into browser, version, OS, device type and engine, and see which rules matched. Pattern matching only. Runs entirely in your browser.
HTTP Status Codes
WebLook up an HTTP status code for its meaning, 1xx–5xx class, typical uses and common traps. Runs entirely in your browser.