Use regex PCRE search for pane in tmux 2026-04-22 ------------------------------------------------------------------------------- Since tmux 3.1, basic regex is available when searching a pane in copy-mode (-b), then / or ?. When you want extended functionality (e.g. with regex PCRE), set a keybind to pipe the content of the pane to grep: bind-key F command-prompt -F -p "PCRE pattern" \ "split-window -v -l 20 \ \"tmux capture-pane -p -t '#{pane_id}' -S - \ | rg --color=always -n -P -- \\\"%%%\\\" \ | LESS= less -R\"" In short: Will user ask for a regex pattern and then open the results in a new pane at the bottom. What this does: command-prompt -F Opens a tmux prompt and expands tmux formats like #{pane_id}. #{pane_id} Expands to the pane ID of the pane where Prefix + F was pressed. split-window -v -l 20 Opens a new 20-line pane at the bottom. tmux capture-pane -p -t '#{pane_id}' -S - Captures the full available scrollback from the original pane and prints it to stdout. rg --color=always -n -P -- "pattern" Searches the captured text with ripgrep. -P enables PCRE2 regex support. -n shows line numbers. --color=always keeps match highlighting enabled. -- stops option parsing so patterns starting with "-" are safe. %%% Is replaced by the regex entered in the tmux prompt, with double quotes escaped safely. LESS= less -R Opens the results in pager less. LESS= clears any existing LESS options, avoiding auto-exit behavior. -R preserves colored output from ripgrep.