# grex
> Generate regular expressions from user-provided test cases

## Summary
A regex generator from test cases. Provide example strings and grex creates the smallest regular expression that matches all of them.

## Capabilities
- Generates regex from positive test cases
- Supports digit, word, and whitespace character classes
- Configurable repetition and anchoring
- Outputs regex compatible with most regex engines

## When to Use
- Need to create a regex matching a set of example strings
- Want a starting point for a regex pattern
- Unfamiliar with regex syntax

## When NOT to Use
- Need a regex for complex patterns with negative cases
- Regex must handle edge cases beyond the examples provided

## Usage Patterns
### Generate regex from examples
```
grex 'foo-123' 'bar-456' 'baz-789'
```
Generates a regex matching all three strings

### Use digit character classes
```
grex -d 'abc-123' 'def-456'
```
Uses \d instead of [0-9] in the generated regex

## Input / Output
- **stdout**: Generated regular expression

## Installation
- **homebrew**: `brew install grex`
- **cargo**: `cargo install grex`

---
Source: https://littlescripts.sh/tools/grex
