From 52dbe3914bde32eb1d9784f72e07d3016cd27c82 Mon Sep 17 00:00:00 2001 From: Vasily Bagirov Date: Tue, 15 Aug 2023 18:48:58 +0300 Subject: [PATCH] Ignoring rules --- .../ad-filtering/create-own-filters.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 432cab275c7..ac19bd5550c 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -204,6 +204,59 @@ AdGuard Safari and AdGuard for iOS do not fully support regular expressions beca ::: +### Ignoring rules {#rules-ignore} + +Rules that match an arbitrarily large number of URLs are considered incorrect and will be ignored. This can happen when the rule doesn't contain a mask, or when 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 following cases: + +- 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: + +```text +$domain=~example.com,script +``` + +- The rule contains [`$app`](#app-modifier) modifier that points to a specific app list. + +These rule will not be ignored: + +```text +$app=curl,document +``` + +This rule will be ignored: + +```text +$domain=~curl,document +``` + +- The rule contains one or more modificators from among [`$cookie`](#cookie-modifier), [`$removeparam`](#removeparam-modifier), [`$removeheader`](#removeheader-modifier), [`$stealth`](#stealth-modifier). + ### 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.