~yerinalexey/rex

ref: 96334d36031b992858a5784efd97dbf2ef68e538 rex/README.md -rw-r--r-- 2.3 KiB
96334d36Alexey Yerin Update style of README 5 months ago

#^[Rr]ex$

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

Screenshot

#Installation

Dependencies:

  • 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.

#Usage

$ rex [flags] [file]

Rex reads file where each line is a test match (multi-line regexes are not supported). If not specified, the text is read from standard input. Lines should be separated by line feeds (\n).

In the interface you are presented with a regex input field and a list of test data highlighted accordingly to them matching a regex.

You can switch between them using Tab or Shift+Tab. Escape exits the application and prints input regex to standard output unless --print-regex=0 flag is specified.

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

Flags/options reference:

  • --input REGEX (-i REGEX) - set default value for regex field (. if not set)
  • --print-regex (-p) - print regex after exit (true by default)
  • --version (-V) - print version number
  • --help (-h) - show help message

To turn off boolean flags, you can assign them to a value of zero after an equal sign: -p=0 or --print-regex=false.

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

#Contributing

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

$ git config format.subjectPrefix "PATCH rex"