grex

CLI

Generate regular expressions from test cases.

Auto-generate regex patterns from example strings

3 curated recipes · not yet executed by the harness#regex#generate#pattern

Recipes

Curated from documentation and usage. Percentages are estimates, not measurements.

Generate regex from examples

~95% est.
grex foo1 foo2 foo3

Generate digit-aware regex

~93% est.
grex --digits foo1 foo2

Generate a regex from a list on stdin

sort -u strings.txt | grex -
Common failures (1)
  • error: the following required arguments were not provided: <INPUT>...grex does not read stdin implicitly; pass a literal - as the input argument

Install

Homebrewbrew install grex
Cargocargo install grex

Agent notes

When to use
Creating regex patterns from input examples
Quick examples
  • grex foo bar baz
  • echo -e 'test1\ntest2' | grex -

Use from an agent

curl -s https://clihub.com/api/tools/grex | jq '.agentHints.provenRecipes[] | {task, command, verified}'

Or call get_tool with slug grex on the MCP server at https://clihub.com/mcp.

Homepage ↗Apache-2.00 views