Rgx โ€” a regex debugger for the terminal (step-through execution, 3 engines, code generation)

โš“ Rust    ๐Ÿ“… 2026-05-23    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 1      

surdeus

I've been working on rgx, a terminal regex debugger written in Rust using ratatui + crossterm. Just shipped v0.12.3.

What makes it different from other terminal regex tools:

The main thing I haven't seen elsewhere is a step-through debugger (Ctrl+D, PCRE2) โ€” it traces execution with a dual-cursor visualization (pattern cursor + text cursor moving together), backtracking markers, and a heatmap mode that shows which parts of the pattern are matched
most often. Useful when a pattern works but you don't understand why, or when backtracking is making it slow.

Beyond that:

  • 3 engines โ€” Rust regex (default), fancy-regex (lookaround / backrefs), PCRE2. Auto-selects the simplest engine that supports your pattern's features.
  • Code generation (Ctrl+G) โ€” emits ready-to-paste code for Rust, Python, JS, Go, Java, C#, PHP, Ruby
  • Generate regex from examples (Ctrl+X) โ€” grex overlay
  • Live filter mode โ€” rgx filter streams stdin/file through a regex TUI; --json <PATH> extracts a specific JSONL field to match against
  • Batch/pipeline mode โ€” echo "log" | rgx -p '\d+' with grep-like exit codes
  • Test suite mode โ€” TOML-based CI assertions (rgx --test)
  • VS Code, Neovim, Zed, tmux integrations

Install:
cargo install rgx-cli
brew install brevity1swos/tap/rgx

GitHub: GitHub - brevity1swos/rgx: regex101 for the terminal โ€” real-time matching, 3 engines, capture groups, replace mode, syntax highlighting, plain-English explanations, undo/redo, mouse support. Written in Rust. ยท GitHub

1 post - 1 participant

Read full topic

๐Ÿท๏ธ Rust_feed