Skip to main content
LABS

Genetic Regex Auto-Healer

Enter what you want to match, and what you want to reject. Our browser-based algorithm evolves the perfect Regular Expression in real-time.

Genetic Regex Auto-Healer

Define test cases for what to accept and reject. Our genetic algorithm mutates expressions against your real data until it finds the optimal surviving pattern.

Load Preset:

Should Match (3)

Positive Cases
user@gmail.com
admin.123@company.co.uk
test-email@domain.com

Should Reject (4)

Negative Cases
user@gmail
admin@.com
test@domain.
invalid email
Generation
0
Fitness Score
0.0%
Best Surviving Regular Expression
// Awaiting evolution initiation...
Operations run 100% locally. Sign in with GitHub to sync pinned tools and presets across machines.
Connect Workspace

Genetic Algorithms for Regex

Writing the perfect Regular Expression often involves tedious trial and error. The Genetic Regex Auto-Healer automates this by applying evolutionary algorithms to 'breed' the perfect regex.

You provide positive test cases (strings that must match) and negative test cases (strings that must not match). The engine randomly mutates an initial pattern, scores the offspring based on accuracy, and evolves them over generations until it finds a pattern that passes all tests.

How to use this tool

  1. Enter a list of strings that the regex MUST match (Target Matches).
  2. Enter a list of strings that the regex MUST NOT match (Anti-Matches).
  3. Provide an optional starting regex (or let the engine start from scratch).
  4. Click 'Evolve' and watch the engine iterate through generations to find the perfect pattern.

Examples

Frequently Asked Questions

Is this guaranteed to find the best regex?
Not necessarily the most human-readable one, but it will find a mathematically valid regex that satisfies your strict constraints.