Tools

Home
Password GeneratorLorem IpsumCoin FlipperRandom NumberToken GeneratorRandom Color

Generate Random Data from RegExp

Generate random strings that match a given regular expression pattern. 100% client-side.

Your files never leave your browser
Presets:
Count:0
Avg Length:-
Unique:-
Ready·Recursive descent regex parser

Drop in a regex pattern, pick how many strings you want, and the generator spits out values that actually match — fake phone numbers, SKU codes, hex colors, whatever your pattern describes. It parses the regex into a syntax tree and walks each node, so every output is a real match, not random gibberish. And everything runs in your browser. Nothing gets uploaded.

How It Works

Enter Regex Pattern
→
Parse Into Syntax Tree
→
Generate Matching Strings

The generator reads your regex and breaks it into tokens — character classes, quantifiers, groups, alternation. For each token, it picks random valid values. A [a-z] might become “m”. A {2,5} quantifier picks a random count between 2 and 5. Alternation with | randomly chooses one branch. The final output is always a valid match for the original pattern.

Examples

US Phone Numbers for a Contact Form Test

Need to fill a QA spreadsheet with realistic-looking phone numbers that won’t accidentally dial a real person.

INPUT
\(555\) [2-9]\d{2}-\d{4}
OUTPUT
(555) 847-3291 (555) 362-0578 (555) 914-6203

Product SKU Codes

Seeding a test database with product records. Each SKU follows the warehouse format: two uppercase letters, a dash, then six digits.

INPUT
[A-Z]{2}-\d{6}
OUTPUT
KR-482917 LX-035684 BW-719360

Hex Color Codes for a Design Mockup

Throwing together placeholder color values for a prototype. Doesn’t matter what the colors are — they just need to be valid hex.

INPUT
#[0-9A-Fa-f]{6}
OUTPUT
#4a8Bf2 #c03D9e #17eA5b

Who Uses This

👨‍💻 Developers

Generate test fixtures — fake emails, IDs, or structured strings — without writing throwaway scripts.

🧪 QA Engineers

Create hundreds of edge-case inputs to stress-test form validation and API endpoints.

🎨 Designers

Fill mockups with realistic placeholder data — phone numbers, order codes, license plates — instead of “Lorem ipsum.”

📊 Data Analysts

Build sample datasets with specific ID formats for pipeline testing before connecting production sources.

Common Mistakes

Forgetting to escape special characters

A period . in regex matches any character, not a literal dot. If your pattern is an IP address like 192.168.0.\d+, you’ll get outputs like 192X168Z0G7. Escape dots as \. when you mean them literally.

Using unbounded quantifiers without adjusting the max length

Patterns like [a-z]+ or \w* have no upper limit. The default max unbounded length caps these, but if it’s set too high you’ll get absurdly long strings. Keep it between 5 and 15 for most use cases.

Expecting advanced regex features to work

Lookaheads ((?=...)), lookbehinds ((?<=...)), and backreferences (\1) aren’t supported. The generator walks forward through the pattern and produces characters — it can’t “look ahead” to decide what to output. Stick to character classes, quantifiers, groups, and alternation.

Technical Details

Frequently Asked Questions

How do I generate random data from a regular expression?

Paste your regex pattern into the input field, set how many strings you want, and click Generate. The tool parses the pattern and builds random strings that match it. You can also pick from presets like phone numbers or emails if you don’t want to write regex from scratch.

What regex syntax does this generator support?

Character classes like [a-z] and [0-9], shorthand classes (\d, \w, \s), quantifiers ({n}, {n,m}, *, +, ?), alternation with |, grouping with parentheses, and literal characters with escape sequences. Lookaheads, lookbehinds, and backreferences are not supported because they require context the generator can’t produce during a forward pass.

Will the output actually match my regex pattern?

Yes. The generator builds an abstract syntax tree from your regex, then walks each node to produce valid characters and repetition counts. Every output string is a genuine match. If something looks off, double-check that special characters like . or ( are escaped properly in your pattern.

Is my data sent to a server?

No. The entire tool runs in your browser with JavaScript. Nothing gets uploaded, logged, or stored anywhere. Close the tab and it’s gone. This makes it safe for generating patterns that involve sensitive formats like internal ID schemes or proprietary codes.

What does the “Max Unbounded Length” setting do?

Quantifiers like * and + have no built-in upper limit. The max unbounded length tells the generator the highest repetition count it should use for these open-ended quantifiers. Set it to 10, and [a-z]+ produces between 1 and 10 characters. Keep it reasonable — going above 20 tends to produce impractically long strings.

Share: