Rewrite a link before it opens
A rewrite changes part of a link before Bouncer opens it. Use it to send a Twitter link to xcancel, for example.
- Enter a real link in Example link:.
- Click Advanced matching with regex under When….
- Enter a pattern that matches only the part you want to change.
- Enter the new text in Replace with. The hint text is
$1, $2.... - Read the preview under the field. It shows the example link after the change.
- Click Save Rule. If you opened the editor from the menu bar, click Save & Reopen to open the rewritten link now.
How a rewrite works
Section titled “How a rewrite works”Bouncer replaces the part of the link that the pattern matched. Everything else stays. The result must still be a valid link.
This is the Twitter/X → xcancel preset:
- When…:
://(www\.)?(twitter\.com|x\.com) - Replace with:
://xcancel.com
With the example link https://twitter.com/octave/status/123, the preview reads https://xcancel.com/octave/status/123. Only ://twitter.com changed.
If the replacement leaves the link unchanged, Bouncer opens the link as it was.
Keep part of the match with $1
Section titled “Keep part of the match with $1”Put parentheses around a part of the pattern to capture it. Then use $1 in Replace with to insert that part. $2 is the second pair of parentheses. $0 is the whole match.
- When…:
twitter\.com/(.*) - Replace with:
xcancel.com/$1
With the example link https://twitter.com/octave/status/123, the parentheses capture octave/status/123. The preview reads https://xcancel.com/octave/status/123.
What happens when the link opens
Section titled “What happens when the link opens”Bouncer rewrites the link first. Then it opens the result in the browser, profile, or app under Open in….
For more syntax, see the Regex and rewrite cheat sheet.