Export CleanLinks default rules in NeatURL-like format

Rules are in the following format: {rule type identifier}{rule matching}[@{domain}[/{path}]]



	
Summary of the Neat-URL rules format with CleanLinks-specific additions

The rule format is as follows: {rule type identifier}{rule matching}[@{domain}[/{path}]]

The original format is explained on the Neat-URL github page, and this page adds special colours for rules that are unused or added.

{parameter} (i.e. no rule type identifier)
Delete matched parameter
!{parameter}
Whitelist (i.e. keep even if matched by other rules) matched parameter
${path section}
Remove all URL contents after matched path section (when no query parameters remain)
$${path section}
Remove all URL contents after matched path section (including path parameters)
#{anchor tag}
Remove anchor tag (needs to include parameter and value) for hashtag-part of URL
#?{anchor tag}
Promote anchor tag from hashtag-part of URL to query-part
%{search}%{replace}%{flags}
Search and replace on the URL. Useful e.g. for tripadvisor which URL-encodes embedded URLs with __2F__ instead of %2F, but also provides more generic versions of the $ rules. For example, the example $/ref@amazon.* becomes %/ref=[^/]*%%@amazon.*
|
Allow (whitelist) URLs embedded in path, to avoid redirecting to embedded links that are in the URL path instead of a parameter: e.g.: https://web.archive.org/web/20200725040621/https://twitter.com/elonmusk/status/1286866843307737088. (The ! rule can be used to allow embedded links in the URL.)
+
Allow (whitelist) javascript to modify links at the moment (or just before) they are clicked, e.g. through onclick and onmousedown events.
>{parameter}
Redirect to the page whose URL is contained in the matched parameter’s value. For CleanLinks, only used in “blacklist” mode, i.e. when embedded URLs are not automatically detected.
Allows other extensions to manually specify what CleanLinks detects automatically, or for a potiential future “blacklist mode”.
>>{matched path with capture group}
Redirect to the page whose URL is contained in the matched group of the current page’s URL path. For CleanLinks, only used as a boolean in “blacklist” mode, i.e. when embedded URLs are not automatically detected.

The suffix usually matches the domain, and CleanLinks adds optional path matching: @domain[/path_matching]

URL example

https://addons.mozilla.org/en-GB/firefox/addon/clean-links-webext/reviews/?score=5

https
Protocol
org
(usually same as top-level domain)
mozilla.org
Domain name
addons.
Subdomain
addons.mozilla.org
Fully-Qualified Domain Name (FQDN)
/en-GB/firefox/addon/clean-links-webext/reviews/
Path
?score=5
Query
score
Parameter