Utilora

Pattern Generator - Learn String Rules from Examples

Provide match and non-match string examples; a decision tree learns the pattern and exports it as Rust, JavaScript, or regex.

How to use

  1. 1

    Add match examples

    Enter strings that should match (e.g. valid emails, IDs, codes).

  2. 2

    Add non-match examples

    Enter strings that should NOT match.

  3. 3

    Train and export

    Click Train to fit the decision tree, then export as Rust, JavaScript, or a best-effort regex.

Why use this tool?

  • Learns structural patterns without writing regex by hand
  • Exports clean Rust or JavaScript validation functions
  • Trains a CART decision tree on 15 string features in milliseconds

Frequently asked questions

How many examples do I need?
At least 4 match and 4 non-match examples. More examples improve accuracy.
How accurate is the regex export?
The regex is a best-effort approximation. The Rust and JS exports are exact and recommended for production use.

Related tools

Popular right now