Skip to content
A command-line tool for generating regular expressions from user-provided input strings
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Add first implementation Oct 5, 2019
.editorconfig Add .gitignore and .editorconfig Oct 5, 2019
.gitignore Add .gitignore and .editorconfig Oct 5, 2019
.travis.yml Fix file name of Windows executable Oct 6, 2019
Cargo.lock Update Cargo.lock Oct 5, 2019
Cargo.toml Add release notes Oct 6, 2019
LICENSE Initial commit Oct 5, 2019 Add badges Oct 6, 2019 Add release notes Oct 6, 2019


Build Status codecov license

grex is a small command-line utility that is meant to simplify the often complicated and tedious task of creating regular expressions. It does so by automatically generating regular expressions from user-provided input strings that match the generated expression.

In its very early stage, this tool is a Rust port of regexgen which has been implemented in JavaScript and runs in a Node.js environment. The plan is, however, to add much more functionality to grex than regexgen provides. The development of the latter was ceased more than two years ago. Compared to regexgen, grex is currently lacking support for character classes. This feature will be added in the next version.


  • literals
  • detection of common prefixes and suffixes
  • alternation using | operator
  • repetition using ? quantifier
  • concatenation of all of the former

How to use

$ grex -h
grex 0.1.0
Peter M. Stahl <>
grex generates regular expressions that match user-provided input strings.

    grex <input>...

    -h, --help       Prints help information
    -V, --version    Prints version information


Some examples

$ grex abc def

$ grex a ab abc

$ grex thankful thoughtful

$ grex 2.0-3.5 2.5-6.0
You can’t perform that action at this time.