Command line playground for regular expressions
3 days ago
a month ago


Rex is a command line playground for regular expressions similar to playground section on ihateregex.io.




  • Go >=1.15
  • GNU Make

With the repository checked out:

$ make
# make install

This will install everything into /usr/local by default so you might need root access to do this. Alternatively you can install into a different directory by setting PREFIX. For example:

$ make install PREFIX="$HOME/.local"

will instal rex into ~/.local/bin.

For packagers: you can set DESTDIR to install into a different system root, e.g. use make install DESTDIR="$pkgdir" PREFIX=/usr on Arch and Alpine.


$ rex [flags] [file]

Rex reads file where each line is a test match. If missing, the text is read from standard input.

The interface consists of an input field with a regular expression to use, and the file colored depending on what lines match that regular expression.

Those can be switched between using Tab or Shift+Tab. Escape exits the application.

File matches can be scrolled using Vi keys: j - down, k - up, etc. Input field supports readline-like bindings: reference.

The following options are supported:

  • --input REGEX (-i REGEX) - default value for the input field (default: .)
  • --print (-p) - print matching lines after exit (default: false). This allows using rex as an interactive filter.
  • --version (-V) - show version number
  • --help (-h) - show the help message

The following values can be accepted by boolean flags: 1, 0, t, f, true, false, TRUE, FALSE, True, False.


Send patches using git send-email to my public inbox with project prefix set to rex:

$ git config format.subjectPrefix "PATCH rex"