Add TextReplace Rules

Seaswimmer 2024-02-02 23:48:27 +00:00
parent 99f03a6722
commit 665ef3e9f1
Signed by untrusted user who does not match committer: CoastalCommits
GPG key ID: 7E73189F651A553F

69
TextReplace-Rules.md Normal file

@ -0,0 +1,69 @@
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`
```regex
Find: https://twitter.com
Replace: https://fxtwitter.com
Only if includes: /status/
```
```regex
Find: https://x.com
Replace: https://fixupx.com
Only if includes: /status/
```
### Change `fandom.com` links to `antifandom.com` links
```regex
Find: fandom
Replace: antifandom
Only if includes: .com/wiki/
```
## Regex Replacement
### Replace `curseforge.com` links with `cflookup.com` links
```regex
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.*
```regex
Find: https?:\/\/(?:www\.)?youtube\.com\/(?:watch\?v=|embed\/|shorts\/)([\w\-]+)
Replace: https://youtu.be/$1
```
### Replace `media.discordapp.com` links with `cdn.discordapp.com`
```regex
Find: https:\/\/media\.discordapp\.net(?=\/)
Replace: https://cdn.discordapp.com
```
### Beautify GitHub Pull Request/Issue embeds (untested)
```regex
Find: https:\/\/(to)?github\.com\/(?<repo>[A-Za-z0-9-]+\/[A-Za-z0-9._-]+)\/(issues|pull)\/(?<number>[0-9]+)\/*
Replace: [$<repo>#$<number>]($&)
```
# Miscellaneous Rules
## Regex Replacement
### Easy Google searching
```regex
Find: \s+
Replace: +
Only if includes: google:
```
```regex
Find: google:(?<query>.*)
Replace: <https://google.com/search?q=$<query>>
```
### Replace `*F` with `°F`
*Also works for Celcius.*
```regex
Find: \*(f|F|c|C)
Replace: °$1
```
### Create an `˗ˏˋ effect ˎˊ˗` around text
*Wrap text in `('text')` to use this.*
```regex
Find: ^\('(.+)'\)$
Replace: ˗ˏˋ $1 ˎˊ˗
```