Regex Generator
Give the generator a few example strings that should match — and optionally some that should not — and get a working regular expression. It analyses the common structure, produces a pattern with a plain-English explanation and validates the result against your negative examples.
How to use
Add positive examples
List strings that should match, one per line.
Add negative examples (optional)
List strings that should not match — helps refine the pattern.
Generate the regex
The tool produces a pattern with an explanation and test results.
Copy or refine
Copy the pattern or adjust examples until it fits your case.
/[a-z]+@[a-z]+\.[a-z]+/g[a-z]+lowercase letter@literal character[a-z]+lowercase letter\.literal character[a-z]+lowercase letterFeatures
Generates from examples
Analyses the common structure across positive examples to build a pattern.
Negative examples support
Use negative examples to detect overly broad patterns.
Explanation included
See a human-readable breakdown of what each part of the regex does.
Validation against negatives
Shows which negative examples still match the pattern.
Common use cases
- Create a regex for validating email addresses
- Build a pattern for phone numbers in a specific format
- Generate a pattern for log line parsing
- Turn a list of example strings into a reusable regex