Kiara Grouwstra
Kiara Grouwstra

Reputation: 5933

how can i use exceptions in uBlock Origin?

in this article, i read a bit about using ~ to create exceptions in a filter rule for ad blockers.

now, i created a rule ||*.com^, which in itself functions to block any .com domains. however, i would like to add exceptions to this rule, let's say starting with stackoverflow.com. to this end i have tried variants of ||*.com^|~stackoverflow.com, tho seemingly to no avail - the rule would just break.

has anyone grasped how to apply exceptions to achieve something similar?

Upvotes: 3

Views: 9610

Answers (1)

R. Hill
R. Hill

Reputation: 3620

You want to exclude domains from your filters, so you need to use the domain= filter option. Specifying filter options:

These options should be separated with a comma (,) after a dollar sign ($) at the end of the filter.

You failed to use the options separator character $. Your filter should be:

||com^$domain=~stackoverflow.com

Notice that I also corrected another mistake in your filter: || means anchor to hostname label. * is not a hostname label, so using || accomplish nothing when followed by a wildcard. Given what you want to achieve with your filter, you want to anchor to com hostname label, hence ||com and the ^ ensure that this is the last label of the domain name.

Upvotes: 3

Related Questions