Syntax: Contains + Ends With

General information, announcements and questions about the EasyList subscriptions.
Locked
adbob
New Member
New Member
Posts: 3
Joined: Wed May 17, 2017 7:51 pm

Syntax: Contains + Ends With

Post 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
intense
Contributor
Contributor
Posts: 10494
Joined: Wed Mar 27, 2013 9:56 am

Post by intense »

add

Code: Select all

/ad.png|
adbob
New Member
New Member
Posts: 3
Joined: Wed May 17, 2017 7:51 pm

Post 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.
User avatar
smed79
Liste AR/FR Author
Liste AR/FR Author
Posts: 15839
Joined: Sun Jan 17, 2010 4:00 am
Location: EasyList Forum

Post 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
•► Read RULES / Use forum Search
••► Don't post clickable links
•••►Upload screenshots at imgbb.com
adbob
New Member
New Member
Posts: 3
Joined: Wed May 17, 2017 7:51 pm

Post 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
User avatar
smed79
Liste AR/FR Author
Liste AR/FR Author
Posts: 15839
Joined: Sun Jan 17, 2010 4:00 am
Location: EasyList Forum

Post 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/
•► Read RULES / Use forum Search
••► Don't post clickable links
•••►Upload screenshots at imgbb.com
Locked