pemistahl/grex

A command-line tool and Rust library with Python bindings for generating regular expressions from user-provided test cases

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 48 minutes ago
Added to GitGenius on September 8th, 2026
Created on October 5th, 2019
Open Issues & Pull Requests: 18 (+0)
GitHub issues: Enabled
Number of forks: 198
Total Stargazers: 8,184 (+1)
Total Subscribers: 44 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

grex is a command-line tool and Rust library with Python bindings that generates regular expressions from user-provided test cases.

The tool addresses the difficulty of manually writing regular expressions by automatically synthesizing a pattern from examples you supply. It takes a set of test cases and produces a single regular expression guaranteed to match all of them. By default, the tool generates the most specific expression possible, matching only the exact inputs provided. Users can enable command-line flags or use preprocessing methods to create more generalized patterns that match broader character classes like digits or word characters.

Developers should adopt grex when they need a starting point for regex patterns rather than a complete solution. It works best for those who understand regular expressions well enough to inspect and refine the generated output, since the tool prioritizes specificity over brevity and may produce longer or more complex patterns than hand-written alternatives. The tool generates Perl-compatible regular expressions that work with Rust's regex crate and most other regex engines. Unlike the JavaScript tool regexgen, which inspired this project, grex offers additional features and active development.

The project maintains steady activity with regular commits addressing bug fixes and feature additions. Development includes comprehensive property-based testing to verify that generated expressions match only their input cases. The maintainer actively responds to issues and incorporates user feedback into updates.