@kszongic/regex-test-cli
v1.0.0
Published
Test regex patterns from the command line — match, extract groups, replace. Zero dependencies.
Maintainers
Readme
@kszongic/regex-test-cli
Test regex patterns from the command line — match, extract groups, replace. Zero dependencies.
Install
npm i -g @kszongic/regex-test-cliUsage
# Simple match
regex-test "\d+" "abc 123 def"
# {"match":"123","index":4}
# All matches
regex-test "\d+" -a "abc 123 def 456"
# [{"match":"123","index":4},{"match":"456","index":12}]
# Capture groups
regex-test "(\w+)@(\w+)" "user@host"
# {"match":"user@host","index":0,"groups":["user","host"]}
# Case-insensitive
regex-test "hello" -f i "Hello World"
# Replace
regex-test "\d+" --replace X "abc 123 def 456"
# abc X def 456
# Stdin
echo "hello world" | regex-test "\w+" -a --stdinOptions
| Flag | Description |
|------|-------------|
| -f, --flags <flags> | Regex flags (g, i, m, s, u) |
| -a, --all | Show all matches (implies g) |
| -r, --replace <str> | Replace matches |
| --stdin | Read from stdin |
| -h, --help | Show help |
License
MIT © 2026 kszongic
