Regex Data Generator
Generate random data that matches your regular expressions
Input
Output
Readme
What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. Originally developed for formal language theory, regular expressions are now used across virtually every programming language and text-processing tool to match, search, and manipulate strings. A pattern like [a-z]+@[a-z]+\.com describes the structure of a simple email address — letters, followed by an @ symbol, more letters, a dot, and the literal string "com."
Beyond searching, regular expressions can also serve as blueprints for generating data. By reversing the matching process, a regex engine can produce random strings that conform to a given pattern. This is particularly useful for software testing, prototyping, and populating databases with realistic-looking mock data without relying on real user information.
Tool description
This tool generates random strings that match any regular expression you provide. Enter a regex pattern — or choose from built-in presets — and instantly produce up to 1,000 matching values. It supports all standard regex syntax including character classes, quantifiers, groups, alternation, and backreferences. The output can be used directly as test fixtures, seed data, or input for validation scripts.
Features
- Built-in presets for common formats: email, IPv4, UUID, US phone number, date, hex color, license plate, and MAC address
- Custom regex input accepting the full JavaScript regular expression syntax
- Adjustable count from 1 to 1,000 generated values per run
- Max repetition control to limit how many times unbounded quantifiers (
+,*,{n,}) expand, preventing excessively long strings - Unique-only mode that deduplicates output and warns if the pattern's entropy is too low to produce enough distinct values
Use cases
- Software testing: Generate hundreds of valid-looking email addresses, UUIDs, or IP addresses to use as test fixtures or seed data for automated test suites without exposing real user information.
- Database seeding: Quickly populate development or staging databases with realistic mock data that conforms to column constraints and validation rules.
- Regex learning: Experiment with regular expression syntax by writing a pattern and immediately seeing what strings it can produce, making it easier to understand quantifiers, character classes, and grouping.
Options explained
| Option | Description |
|---|---|
| Preset | Select a built-in pattern for common data formats, or choose "Custom" to write your own regex. Selecting a preset automatically fills in the regex pattern field. |
| Regex pattern | The regular expression used to generate data. Supports character classes ([a-z]), quantifiers ({3,8}, +, *), groups and alternation ((com|net|org)), and special tokens (\d, \w). |
| Count | How many strings to generate, between 1 and 1,000. |
| Max repetition | Caps the expansion of unbounded quantifiers. For example, with max repetition set to 10, the pattern [a-z]+ will produce strings of at most 10 characters. Range: 1–100. |
| Unique values only | When enabled, ensures no duplicate strings appear in the output. If the pattern cannot produce enough unique values, a warning is shown with the actual number generated. |
Tips
- Start with a preset and modify it to learn how regex patterns translate into generated data.
- If you need fixed-length output, use exact quantifiers like
{8}instead of ranges like{5,10}. - Lower the max repetition value when using
+or*to keep generated strings short and readable. - Enable unique mode when generating identifiers or keys that must not repeat, but use a pattern with enough variation to avoid hitting the uniqueness ceiling.
FAQ
Can I use lookaheads or lookbehinds? The generator is based on the randexp.js library, which supports most JavaScript regex features. Lookaheads and lookbehinds are not supported for generation since they don't define character content.
Why did I get fewer results than requested? With "Unique values only" enabled, the pattern may not have enough possible permutations to produce the requested number of distinct strings. Try broadening the character classes or increasing quantifier ranges.
Is the output truly random? The output is pseudo-random. Each run produces different results, but the randomness is not cryptographically secure. Do not use this tool to generate passwords or security tokens.