Regex String Generator
Enter a pattern and how many samples you want.
About this tool
Nested unbounded quantifiers and very long patterns are rejected.
The samples are examples, not a proof that the pattern is correct.
How to use it
- Open this page and provide the input it asks for.
- Set the options that are visible, then use Generate strings.
- Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.
Limitations
- The samples are examples, not a proof that the pattern is correct.
A bounded walker, not a RegExp engine
The limits that reject a pattern
The pattern string must be at most 80 characters. A run of two quantifier-like marks, including star, plus, and an opening brace, with only whitespace between them, is rejected. A pattern that contains the four characters dot-star-dot-star is rejected. Sample counts are integers in the band 1..20, and the field starts at 5. Each sample is built by a single left-to-right walk that stops after 64 characters of output. These caps exist so the page cannot be asked to blow up on a nested quantifier. They are not a general safety proof for every expensive expression. They are the checks the function actually runs.
What the walk understands
A backslash copies the next character and does not interpret classes such as d or s. An opening bracket takes the raw slice until the next closing bracket, or a one-character slice if the bracket is missing, and appends one character chosen from that slice with randomInt. The range a-z is three characters, a, hyphen, and z, not twenty-six letters. A dot appends one letter from a through z, not an arbitrary byte. A star repeats the current character 0, 1, or 2 times. A plus repeats it 1, 2, or 3 times. A question mark repeats it 0 or 1 time. Those counts are randomInt, so they are the small integers above, not an unbounded Kleene star. Caret, dollar, parentheses, and the vertical bar are skipped. Skipping the bar means a|b becomes the two letters ab, not a choice between a and b. A brace is not parsed as a counted quantifier.
The random integers come from crypto.getRandomValues through randomInt. The pattern itself is not random. Two clicks can differ where a quantifier or a class or a dot asked for a draw.
Not an engine, and not a proof
The walker never constructs a JavaScript RegExp, never searches, and never tests whether the sample matches the pattern. Samples can fail to match what you typed, because alternation, ranges, escapes, and counted braces are not implemented. Do not use a sample as evidence that the pattern is correct, and do not use a failure to appear as evidence that the pattern is wrong. Use a real tester for that. Reach for it when you want a short, bounded illustration from the subset above: literals, a crude class, a dot that means a lowercase letter, and tiny repeats. Anything richer should be written by hand or generated by an engine that actually implements it.
Privacy
Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.

