Regex Generator from Samples
Generate a reviewable starting pattern from examples. Broader candidates must match every positive and reject every negative; otherwise use exact escaped alternatives and report conflicts.
A QUICK WALKTHROUGH
How to use this tool
- Enter positive and optional negative samples, one per line.
- Choose anchoring and case sensitivity, then generate.
- Review the rule, missed positives and matched negatives; try an unseen live sample.
Limited rule inference
Candidates include email, IPv4, ISO date, hex and HTTP/HTTPS URL shapes, shared prefix/suffix, ASCII class lengths and escaped literals. Shapes do not validate real dates, IP ranges or external resources.
Limits and matching
Up to 100 samples combined, 200 characters each and 20,000 input characters. Live samples are limited to 1,000 characters and regex output to 20,000. Empty lines are ignored. No user-supplied regex, eval or uploaded data is used.
GOOD TO KNOW
Common questions
Can this infer any language?
No. It chooses among finite deterministic rules; unfamiliar formats use literal alternatives.
Does rejecting negative samples prove correctness?
No. Unseen values may behave differently. Case-insensitive or unanchored matching can also create conflicts.
Is this a ReDoS audit?
No. Generated patterns use escaped literals or bounded, non-nested classes and quantifiers, but this is not a security certification.