rgx
regex101, but in your terminal
A terminal regex debugger with real-time matching, capture group highlighting, and plain-English explanations. Written in Rust.

Press F1 in the app for a multi-page cheat sheet with keyboard shortcuts, regex syntax, and engine-specific features.
Features
- Real-time matching — matches update on every keystroke
- Syntax-highlighted pattern input — AST-based coloring for groups, quantifiers, character classes, anchors, and escapes
- 3 regex engines — Rust
regex(default),fancy-regex(lookaround/backrefs), PCRE2 (full features) - Capture group highlighting — distinct colors per group, nested group support
- Plain-English explanations — walks the regex AST to generate human-readable breakdowns
- Replace/substitution mode — live preview with
$1,${name},$0/$&syntax - Match detail + clipboard — navigate matches/captures with Up/Down, copy with Ctrl+Y
- Pattern history + undo — Ctrl+Z/Ctrl+Shift+Z undo/redo, Alt+Up/Down browse history
- Context-sensitive cheat sheet — F1 multi-page help: shortcuts, regex syntax, engine-specific features
- Whitespace visualization — toggle with Ctrl+W to show spaces as
·, newlines as↵, tabs as→ - Mouse support — click to focus/position cursor, scroll to navigate panels
- Engine selector — switch engines with Ctrl+E, see where behavior differs
- Regex flags — toggle case-insensitive, multiline, dotall, unicode, extended
- Stdin pipe support —
echo "test string" | rgx '\d+' - Cross-platform — Linux, macOS, Windows
Installation
From crates.io
From prebuilt binaries
Download from GitHub Releases.
Shell installer
|
Homebrew
From source
Without PCRE2 (zero C dependencies)
Usage
# Interactive mode
# Start with a pattern
# Pipe text from stdin
|
# Use a specific engine
# With flags
# With replacement template
Keyboard Shortcuts
| Key | Action |
|---|---|
Tab |
Cycle focus: pattern / test / replace / matches / explanation |
Up/Down |
Scroll panel / move cursor / select match |
Enter |
Insert newline (test string) |
Ctrl+E |
Cycle regex engine |
Ctrl+Z |
Undo |
Ctrl+Shift+Z |
Redo |
Ctrl+Y |
Copy selected match to clipboard |
Ctrl+W |
Toggle whitespace visualization |
Ctrl+Left/Right |
Move cursor by word |
Alt+Up/Down |
Browse pattern history |
Alt+i/m/s/u/x |
Toggle flags (case, multiline, dotall, unicode, extended) |
F1 |
Show help (Left/Right to page through) |
Mouse click |
Focus panel and position cursor |
Mouse scroll |
Scroll panel under cursor |
Esc |
Quit |
Engines
| Engine | Features | Dependencies |
|---|---|---|
| Rust regex (default) | Fast, linear time, Unicode | Pure Rust |
| fancy-regex | + lookaround, backreferences | Pure Rust |
| PCRE2 | + possessive quantifiers, recursion, conditionals | Requires libpcre2 |
Comparison
| Feature | rgx | regex-tui | rexi | regex101.com |
|---|---|---|---|---|
| Real-time matching | Yes | Yes | Yes | Yes |
| Multiple engines | 3 | 2 | 1 | 8 |
| Capture group highlighting | Yes | No | No | Yes |
| Plain-English explanations | Yes | No | No | Yes |
| Replace/substitution | Yes | No | No | Yes |
| Match clipboard copy | Yes | No | No | Yes |
| Undo/redo | Yes | No | No | Yes |
| Whitespace visualization | Yes | Yes | No | No |
| Mouse support | Yes | No | No | N/A |
| Regex flags toggle | Yes | Yes | No | Yes |
| Stdin pipe support | Yes | Yes | Yes | No |
| Offline / no browser | Yes | Yes | Yes | No |
| Cross-platform binary | Yes | Yes | No | N/A |
Configuration
rgx looks for a config file at ~/.config/rgx/config.toml:
= "rust" # "rust", "fancy", or "pcre2"
Contributing
See CONTRIBUTING.md for details.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.