Page 1 of 1

Syntax: Contains + Ends With

Posted: Wed May 17, 2017 8:03 pm
by adbob
Hi, I'm trying to create a list and want to get a syntax right but cannot for the life of me. Filter experts please help. For example,

I want to match with:

Code: Select all

https://www.google.com/bla/AD.PNG
http://ads.google.com/bla/AD.PNG
https://google.ca/bla/AD.PNG
https://adsbygoogle.com/bla/AD.PNG
And so forth. There is an endless list of TLDs that can exist so I'm not interested in typing out:

Code: Select all

||google.com
||google.ca
I also don't mind a slight amount of false positives but not excessive of course. Anyway the best I can come up with was:

Code: Select all

google*AD.PNG
It works but don't think it's the best rule possible. I couldn't figure out how to use the | to specify ends with whilst having other regexp within the rule. Obviously I want to be as specific as possible to make it efficient.

Thank you

Re: Syntax: Contains + Ends With

Posted: Wed May 17, 2017 8:55 pm
by intense
add

Code: Select all

/ad.png|

Re: Syntax: Contains + Ends With

Posted: Wed May 17, 2017 10:36 pm
by adbob
Hi thank you for the response but it doesn't handle the "contains" part of my requirement. That rule will block anything ending with "ad.png" but does not require that the domain contains a "google" in it.

Re: Syntax: Contains + Ends With

Posted: Thu May 18, 2017 2:33 am
by smed79
I want to be as specific as possible to make it efficient.
From the good (more specific) to the bad (can cause fp's) ...

Code: Select all

||www.google.com/bla/AD.PNG
||ads.google.com/bla/AD.PNG
||google.ca/bla/AD.PNG
||adsbygoogle.com/bla/AD.PNG

Code: Select all

||google.com/bla/AD.PNG|
||google.ca/bla/AD.PNG|
||adsbygoogle.com/bla/AD.PNG|

Code: Select all

||google.com^*/AD.PNG|
||google.ca^*/AD.PNG|
||adsbygoogle.com^*/AD.PNG|

Code: Select all

||google.*/bla/AD.PNG|
||adsbygoogle.com/bla/AD.PNG|

Code: Select all

||google.*/AD.PNG|
||adsbygoogle.com/bla/AD.PNG|

Code: Select all

||google.*/AD.PNG|
||adsbygoogle.*/AD.PNG|

Code: Select all

google.*/bla/AD.PNG|

Code: Select all

google.*/AD.PNG|

Code: Select all

google*/AD.PNG|

Code: Select all

google*AD.PNG
Adblock plus filter cheatsheet https://adblockplus.org/filter-cheatsheet
filter syntax viewtopic.php?p=113220#p113220

Re: Syntax: Contains + Ends With

Posted: Thu May 18, 2017 9:05 pm
by adbob
Thank you kind sir. Is there a reason this wouldn't work?

Code: Select all

google*/AD.PNG|
Edit: I mean to say

Code: Select all

||google*/AD.PNG|
Has anyone built a simple online tester that I can use, it would save me some development time.

Thank you

Re: Syntax: Contains + Ends With

Posted: Thu May 18, 2017 9:25 pm
by smed79
adbob wrote:Is there a reason this wouldn't work?

Code: Select all

||google*/AD.PNG|
Will work but block also :

Code: Select all

http://googlemaps.com/help/ad.png
http://google.wikipedia.org/images/ad.png
http://google.msn.com/autopromo/ad.png
http://www.googletips.com.us/ad.png
http://anydomain.google/ad.png
adbob wrote:Has anyone built a simple online tester that I can use, it would save me some development time.

Code: Select all

http://htmledit.squarefree.com/
http://codemagic.gr/
http://liveweave.com/
http://jsbin.com/?html,output
https://jsfiddle.net/
http://www.cssdesk.com/
http://plnkr.co/edit/
http://dabblet.com/