15
TextReplace Rules
Seaswimmer edited this page 2024-05-22 02:09:02 +00:00
Table of Contents
- Link Manipulation
- String Replacement
- Change twitter.com/x.com links to fxtwitter.com/fixupx.com
- Change fandom.com links to antifandom.com links
- Regex Replacement
- Replace curseforge.com links with cflookup.com links
- Replace YouTube links and YouTube Shorts links with youtu.be links
- Replace media.discordapp.com links with cdn.discordapp.com
- Beautify GitHub Pull Request/Issue/Discussion links
- Beautify CoastalCommits Pull Request/Issue links
- Beautify CoastalCommits Commit Links
- Beautify CoastalCommits Compare Links
- Beautify CoastalCommits Repository Links
- Beautify Modrinth Links
- Miscellaneous Rules
This page contains a list of TextReplace rules I use.
Link Manipulation
String Replacement
Change twitter.com
/x.com
links to fxtwitter.com
/fixupx.com
Find: https://twitter.com
Replace: https://fxtwitter.com
Only if includes: /status/
Find: https://x.com
Replace: https://fixupx.com
Only if includes: /status/
Change fandom.com
links to antifandom.com
links
Find: fandom
Replace: antifandom
Only if includes: .com/wiki/
Regex Replacement
Replace curseforge.com
links with cflookup.com
links
Find: ((legacy|www)\.)?curseforge\.com
Replace: cflookup.com
Only if includes: mod
Replace YouTube links and YouTube Shorts links with youtu.be
links
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
Replace media.discordapp.com
links with cdn.discordapp.com
Find: https:\/\/media\.discordapp\.net(?=\/)
Replace: https://cdn.discordapp.com
Beautify GitHub Pull Request/Issue/Discussion links
Find: https:\/\/(to)?github\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/(issues|pull|discussions)\/(?<number>[0-9]+)\/*
Replace: [$<repo>#$<number>]($&)
Beautify CoastalCommits Pull Request/Issue links
Find: https:\/\/(www.)?coastalcommits\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/(issues|pulls)\/(?<number>[0-9]+)\/*
Replace: [$<repo>#$<number>]($&)
Beautify CoastalCommits Commit Links
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>)]($&)
Beautify CoastalCommits Compare Links
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>)]($&)
Beautify CoastalCommits Repository Links
Find: https:\/\/(?:www\.)?coastalcommits\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/?(?=\s|$)
Replace: [$<repo>](&)
Beautify Modrinth Links
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>>
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 ˎˊ˗