grex automatically generates regular expressions from test cases you provide, eliminating the need to manually construct complex patterns. Simply supply example strings that should match, and the tool produces a single regex guaranteed to match those inputs.
The tool excels at detecting common patterns like repeated substrings, shared prefixes and suffixes, and character class opportunities. It handles Unicode characters seamlessly, including non-ASCII text and astral code points, with optional conversion to surrogate pairs. You can choose between case-sensitive or case-insensitive matching, use capturing or non-capturing groups, and add anchors as needed.
Key capabilities include:
Important note: While grex produces correct initial expressions, manual inspection and refinement is often beneficial. The generated regex matches your test cases precisely but may be longer than hand-optimized versions. Understanding regex fundamentals helps you evaluate and improve the output for your specific use case. Available as both a command-line tool and Rust library, grex works across Linux, macOS, and Windows platforms.
$ pip install grex$ pip install maturinActivity score
71/100
Stars
Forks
Latest version
Last commit
First release
Language
License
Auto-fetched .
★ 9.1k · v1.48.0 · python