RegexLab

CLI regex toolkit: tester, builder, transformer + benchmark/fuzz/diff/audit

v2.0.1
Linux

Quick Start

Install via jcli

jcli install regexlab

Match a pattern

# With a built-in template
regexlab match --template ipv4 --input access.log

# Inline
regexlab match '\d+' 'abc 123 def 456'

# Named groups
regexlab groups '(?P<y>\d{4})-(?P<m>\d{2})-(?P<d>\d{2})' '2026-05-31'

Build a regex from examples or a log file

# From marked text (mode 1)
regexlab build "Server <<10.0.0.1>> up at <<10:30:45>>"

# From positive/negative examples (mode 2)
regexlab build --match 1.2.3.4 10.0.0.1 --reject abc 999.999

# From a log file: preview, select fields, parallel-apply (mode 3)
regexlab build --from-log access.log
regexlab --format csv build --from-log access.log --select 1=ip 3=user --apply

Transform structured data

# Filter, sort, then convert to JSON
regexlab --format json transform alerts.csv --where "severity >= 7" --sort severity:desc

# Group + count
regexlab transform logs.csv --group-by action --count --sort count:desc

# Flatten nested JSON
regexlab --format csv transform events.json --flatten

NEW v2.0: benchmark / fuzz / diff / audit

# Measure throughput + score ReDoS risk
regexlab benchmark '(a+)+' "aaaaaaaaa!" --iterations 1

# Generate strings that match a pattern (fixtures!)
regexlab fuzz '(?:GET|POST) /api/\w+' --count 8

# Compare two patterns — what does A catch that B misses?
regexlab diff '\d+' '\d{3}' "12 345 6789 1"

# Scan a source tree for risky regex literals (Python/JS/Rust/Go/Ruby)
regexlab audit ./src

What's new in v2.0 (Rust rewrite)

Subcommands

CommandWhat it does
matchFind every match of a pattern (or --template) in input
groupsShow captured groups for each match, named or numeric
replaceRegex substitution; --apply emits replaced text only
splitSplit text by pattern; --apply one-part-per-line
explainToken-by-token breakdown of any pattern
templatesList the 40+ built-in patterns; --tag filter
interactiveREPL with :flags / :explain / :history / :load
buildReverse-regex: marked text, examples, or log-file segmentation
transformCSV/JSON/TSV/JSONL ops: select/where/sort/group/flatten/stats
benchmark NEWThroughput + ReDoS risk score
fuzz NEWGenerate matching strings (regex inversion)
diff NEWCompare two patterns against the same input
audit NEWScan a directory for regex literals + ReDoS risk