Page 1 of 1
block "hit" but not "white"
Posted: Fri Jun 15, 2007 7:45 am
by mass
I haven't been able to accomplish this by using regexp. Any help would be greatly appreciated

Posted: Sun Jun 17, 2007 3:55 pm
by Adblock Plus Fan
Normally there's the whitelist feature for exceptions, but what you want ('white') is too short and unspecific to recommend for a whitelist.
And regexps are not recommended either, they are very slow compared to normal filters.
Posted: Sun Jun 17, 2007 4:45 pm
by rick752
If it is a page element that you want to hide, you can do it like this:
Code: Select all
somesite.com##div[id*="hit"] :not([id*="white"])
Posted: Sun Jun 17, 2007 5:00 pm
by rick752
added to above
If it is specifically images or graphics that you are trying to do this to, this is how you would hide/allow them:
Code: Select all
somesite.com##img[src*="hit"] :not([src*="white"])
.... where something in the image's address has "hit" in it .... but it will not hide something with "hit*white" in the address. So that string says to hide anything with "hit" but :NOT if it also contains "white". It acts as an element 'self-whitelisting' rule.
Remember though that this is only 'hiding' them (still downloaded) ... NOT blocking them (not downloaded). So if you just want to do it just for visual impact you can do it this way.
Posted: Tue Jun 19, 2007 1:19 am
by mrbene
The regex:
will match "hit" and not "white", provided "hit" is bounded by additional characters - ie, it will match "/hit/" or "/hitcounter", but it won't match the text "hit" outright.
It'll also match anything that starts with the popular four letter word for fecal matter, so you may want to include "s" in the first block, or be explicit in what bounding chars you expect:
Code: Select all
[^ws]hit[^e]
[\/\.\?_=\-\&\d\!]hit
Untested examples of the top of my head.
Enjoy.
Posted: Tue Jun 19, 2007 1:36 am
by rick752
Can't use:
?
None of these would block "white".
Posted: Tue Jun 19, 2007 2:21 am
by mrbene
rick752 wrote:Can't use:
?
None of these would block "white".
Doesn't match the exercise - none of those are regex

Posted: Tue Jun 19, 2007 2:26 am
by rick752
Oops ... I guess I didn't read the sentence in the first post close enough. I was concentrating more on the title of the post.
Never mind

Posted: Tue Jun 19, 2007 3:09 am
by mrbene
I'd say that either interpretation is valid - the requirement of using regex is implied by the OPs statement
I haven't been able to accomplish this by using regexp.
but the actual request isn't specifically "and how would it be done using regex"...