Page 1 of 1

Blocking Advertisements on similar domain name?

Posted: Mon Jan 25, 2016 8:22 am
by fenslett
Hey guys.
I'm just wondering about how to hide/block ads on the specific domain name that kees changing constantly like this:
domain1.com/img/ad.jpg
domain2.com/img/ad.jpg
domain.co.ca/img/ad.jpg
... and so on.

EDIT :
I don't know why, but not only ccTLD and gTLD but also its domain name keep changing once every two weeks.
Is there any way to block them at a time?

Re: Blocking Advertisements on ever-changing domain name?

Posted: Mon Jan 25, 2016 8:34 am
by mapx
provide the real example and explain what elements you want to block / hide

Re: Blocking Advertisements on ever-changing domain name?

Posted: Mon Jan 25, 2016 4:51 pm
by lewisje
fenslett wrote:I know I can use the caret symbol(^) to make a rule that embraces different country domain suffixes as in domain^ to block domain.com and domain.co.ca.
No you can't: filters#separators

Re: Blocking Advertisements on ever-changing domain name?

Posted: Wed Mar 02, 2016 4:01 pm
by fenslett
mapx wrote:provide the real example and explain what elements you want to block / hide
Sorry for the confusion and late response.
I want to block ads on similar domain name:
  • domain1.com/img/ad.jpg
    domain2.com/img/ad.jpg
    domain.co.ca/img/ad.jpg
    ... and so on.
I made a rule manually whenever the domain name changed, but it was quite irritating stuff.
So, I tried to find how to block ads on those domain in one line, however I couldn't.

Re: Blocking Advertisements on similar domain name?

Posted: Wed Mar 02, 2016 7:22 pm
by lewisje
That's not "the real example": You just re-stated the OP.

There is no wildcard for public suffixes in hiding rules, unfortunately; now for the part of the domain that changes, you might try a regex filter:

Code: Select all

/^http(?:s)?\:\/\/(?:[-\w][-\w]*\.)*domain\d*(?:\.[-a-z]*)(?:\.[-a-z]*)?(?:\:\d\d{,4})?\/img\/ad\.jpg(?!\w)/
I used a couple of optimizations here: Instead of the + (one or more) modifier, I used the pattern and then followed it with the * (zero or more) modifier (and I did something similar with what would normally be the {1,5} modifier); also, I made sure to use non-capturing groups throughout.