16 TextReplace Rules
Seaswimmer edited this page 2024-12-20 11:48:39 -05:00

This page contains a list of TextReplace rules I use.

Link Manipulation

String Replacement

Find: https://twitter.com
Replace: https://fxtwitter.com
Only if includes: /status/
Find: https://x.com
Replace: https://fixupx.com
Only if includes: /status/
Find: fandom
Replace: antifandom
Only if includes: .com/wiki/

Regex Replacement

Find: ((legacy|www)\.)?curseforge\.com
Replace: cflookup.com
Only if includes: mod

This also allows YouTube Shorts to be embedded and played as normal videos.

Find: https?:\/\/(?:www|music)?(?:\.)?youtube\.com\/(?:watch\?v=|embed\/|shorts\/)([\w\-]+)
Replace: https://youtu.be/$1
Find: https:\/\/media\.discordapp\.net(?=\/)
Replace: https://cdn.discordapp.com
Find: https:\/\/(to)?github\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/(issues|pull|discussions)\/(?<number>[0-9]+)\/*
Replace: [$<repo>#$<number>]($&)
Find: https:\/\/(www.)?coastalcommits\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/(issues|pulls)\/(?<number>[0-9]+)\/*
Replace: [$<repo>#$<number>]($&)
Find: https:\/\/(www.)?coastalcommits\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/(commit)\/(?<hash>[A-Za-z0-9-]{10})[A-Za-z0-9-]{30}\/*
Replace: [$<repo> ($<hash>)]($&)
Find: https:\/\/(www.)?coastalcommits\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/(compare)\/(?<hash1>[A-Za-z0-9._-]+)(?<dots>\.{2,3})(?<hash2>[A-Za-z0-9._-]+)\/*
Replace: [$<repo> ($<hash1>$<dots>$<hash2>)]($&)
Find: https:\/\/(?:www\.)?coastalcommits\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/?(?=\s|$)
Replace: [$<repo>](&)
Find: https:\/\/(?:www\.)?modrinth\.com\/(?<type>mod|plugins|datapacks|shaders|resourcepacks|modpacks)*\/(?<name>.*)
Replace: [$<name> ($<type>)]($&)

Miscellaneous Rules

Regex Replacement

Easy Google searching

Find: \s+
Replace: +
Only if includes: google:
Find: google:(?<query>.*)
Replace: <https://google.com/search?q=$<query>>

Easy DuckDuckGo searching

Find: \s+
Replace: +
Only if includes: ddg:
Find: ddg:(?<query>.*)
Replace: <https://duckduckgo.com/?q=$<query>>

Replace *F with °F

Also works for Celcius.

Find: \*(f|F|c|C)
Replace: °$1

Create an ˗ˏˋ effect ˎˊ˗ around text

Wrap text in ('text') to use this.

Find: ^\('(.+)'\)$
Replace: ˗ˏˋ $1 ˎˊ˗