regm

ci build GitHub License deno version

regm is an interactive command-line tool for matching regular expressions.
It provides a simple interface for testing regular expressions against input text, supporting various flavors of regular expressions such as ECMA, Basic (BRE), Extended (ERE), PCRE, Vim, and RE2.

Install

# Deno
$ deno install --allow-env --allow-read https://deno.land/x/regm/regm --name regm --force

# Homebrew
$ brew install Syu-fu/tap/regm

Example

regm.gif

$ echo -e "apple\nbanana\norange\npear\ngrape\nkiwi" > match.txt
# stdout shows the input when the Enter key is pressed.
$ regm -f match.txt | pbcopy

Usage

Options

Option Description
-h, --help Display help information.
-V, --version Display the version number.
-f, --file Read input text from a file. (required)

Flavor options

Choose one of the following flavor options (defaults to ECMA flavor if not specified):

Option Description
-e, --ecma ECMA flavor. (JavaScript, Java)
-b, --basic Basic flavor (BRE).(grep)
-x, --extended Extended flavor (ERE). (egrep)
-p, --pcre PCRE flavor. (Perl, PHP)
-v, --vim Vim flavor. (Vim, Neovim)
-r, --re2 RE2 flavor. (Go, Python)

Completion

Add .bashrc

source <(regm completions bash)

zsh

Add .zshrc

source <(regm completions zsh)

fish

Add config.fish

source (COMMAND completions fish | psub)