-
-
Notifications
You must be signed in to change notification settings - Fork 118
Description
Description
The regex_replace template transformation documented at https://alexpasmantier.github.io/television/advanced/template-system/ does not seem to work. Instead of applying the regex replacement, television outputs the raw template string as a literal.
Other transformations (strip_ansi, split, piping them together) all work correctly. Only regex_replace appears broken.
Example
Minimal custom channel (~/.config/television/cable/test.toml):
[metadata]
name = "test"
[source]
command = "echo 'hello world'"
output = "{regex_replace:\\s+:_}"Open with tv test, select an entry.
Expected:
tv test
hello_worldActual:
tv test
{regex_replace:\s+:_}I also tried these variations, all with the same result:
{strip_ansi|split: :1|regex_replace:^~:@}{regex_replace:^~:$HOME}{regex_replace:hello:goodbye}
Expected behavior
regex_replace should apply the regex substitution to the entry. For example, {regex_replace:\\s+:_} on hello world should output hello_world.
Actual behavior
The literal template string is output instead (e.g., {regex_replace:\\s+:_}).
Environment
- OS: macOS (Darwin 24.6.0, arm64)
- TV version: 0.15.2
- Shell: fish
- Terminal: ghostty (inside tmux)
- Config: default
~/.config/television/config.toml - Channel: custom channel (shown above)
Additional context
I was trying to use regex_replace in the output field of a custom channel to expand ~ back to $HOME for paths that are display-shortened. The workaround for now is to avoid regex_replace and handle the transformation externally.