diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index e8a85bc6731..c47c89673e1 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -71,7 +71,7 @@ Filtering rules support numerous modifiers that allow you to fine-tune the rule **This rule blocks:** -- `http://example.org/script.js` if this script is loaded from `example.org`. +- `http://example.org/script.js` if this script is loaded from `example.com`. **This rule does not block:** @@ -204,6 +204,68 @@ AdGuard Safari and AdGuard for iOS do not fully support regular expressions beca ::: +### Restrictions on rules application {#rules-restrictions} + +Rules that match an arbitrarily large number of URLs are considered incorrect and will be ignored. This can happen if the rule doesn't contain a mask, or if the mask matches any URL with a certain protocol. + +This rule will be ignored: + +```text +|http://$replace=/a/b/ +``` + +This limitation can be circumvented by using a `/.*/` regular expression inside the mask. + +This rule will not be ignored: + +```text +/.*/$replace=/a/b/ +``` + +**Exceptions** + +This rule validation is not applied in the following cases: + +1. The rule contains [`$domain`](#domain-modifier) modifier that points to a specific domain list. + + These rules will not be ignored: + + ```text + $domain=example.com,script + $domain=example.*,script + ``` + + This rule will be ignored because of domain negation, which causes too wide of a rule application scope: + + ```text + $domain=~example.com,script + ``` + +1. The rule contains [`$app`](#app-modifier) modifier that points to a specific app list. + + This rule will not be ignored: + + ```text + $app=curl,document + ``` + + This rule will be ignored because of app negation, which causes too wide of a rule application scope: + + ```text + $app=~curl,document + ``` + +1. The rule contains one or more modifiers from among [`$cookie`](#cookie-modifier), [`$removeparam`](#removeparam-modifier), [`$removeheader`](#removeheader-modifier), [`$stealth`](#stealth-modifier). + + These rules will not be ignored: + + ```text + $removeparam=cx_recsWidget + $cookie=ibbid + $removeheader=location + $stealth + ``` + ### Wildcard support for TLD (top-level domains) {#wildcard-for-tld} Wildcard characters are supported for TLDs of the domains in patterns of [cosmetic](#cosmetic-rules), [HTML filtering](#html-filtering-rules) and [JavaScript](#javascript-rules) rules.