grex
$ grex Community Low Riskgrex synthesizes guaranteed-matching regular expressions from example strings passed as arguments, stdin, or -f <file>. It is 100% stateless and read-only, supporting character class generalization (-d digits, -w word chars, -s whitespace), repetition detection (-r), and --no-anchors.
brew install grex Stateless millisecond regex synthesis on the CLI; an MCP server is completely unnecessary.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Deterministic, non-interactive single-line stdout output honoring NO_COLOR, though it has no --json wrapper.
- Outputs a single clean regex line on stdout; respects
NO_COLOR
100% stateless read-only computation with zero file writes, network access, or shell execution.
- Strictly read-only string-to-regex generator
Static Rust binary packaged via brew install grex, cargo install grex, and GitHub Releases on macOS, Linux, and Windows.
- Zero-dependency binary across all three platforms
Eliminates LLM regex-escaping errors by mechanically deriving valid patterns from concrete positive examples.
- Supports
-d,-w,-s,-r, and--no-anchorsflags
Well-maintained Rust crate and CLI (pemistahl/grex) under Apache-2.0.
- Mature
pemistahl/grexrepository
Clear README examples and comprehensive --help options.
- Every flag clearly illustrated with input/output examples
Security, Auth & Guardrails
None required; stateless local computation.
100% free, offline, and open-source (Apache-2.0).
# grex Agent Rules - Pass `--no-anchors` when embedding the generated regex inside a larger pattern or `grep`/`rg` search. - Always omit `-c` (`--colorize`) in agent shells so stdout contains only the raw regex string.
Agent-Ready Command Recipes
Safe Read-Only Queries
grex -d -r --no-anchors v1.2.3 v10.0.12 v2.4.5
Synthesizes a compact unanchored regex matching version-like inputs using \d and {min,max} quantifiers.
grex -f examples.txt
Reads one test string per line from examples.txt and outputs a single-line anchored regex.
Strengths for Agents
- + Zero side effects: produces exact, tested regexes from concrete example strings.
- + Supports
-d,-w,-s,-r, and--no-anchorsfor clean generalization.
Caveats & Pitfalls
- ! Only infers from positive examples (cannot take negative counter-examples).
- ! Outputs raw regex string without a
--jsonenvelope.