Skip to content
/ regm Public

An interactive command-line tool for matching regular expressions.

License

Notifications You must be signed in to change notification settings

Syu-fu/regm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 --import-map https://deno.land/x/regm/import_map.json https://deno.land/x/regm/regm.ts --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 (regm completions fish | psub)