I have to say that the main "Writing Adblock Plus filters" page has left me totally confused about the wildcard and/or regular expression syntax. I'm actually familiar with using both wildcards and regular expressions in other applications but I can't find a good explanation of Adblock wildcards by Googling. Is there a proper explanation of Adblock wildcard syntax somwhere? Where?
For example: Apparently we can use "*" as a general string-matching wildcard, but is there a single-character matching wildcard? Normally wildcards include something like "?" to match a single character but that's evidently not the case here.
And regular expressions: regular expressions have a syntax that is contradictory to normal wildcards so an explicit indication is required to denote that that the expression IS a regular expression and not a wildcard expression. But what is that for Adblock filters? For example, foo* matches any string beginning with foo if it's a wildcard but matches "fo" followed by any number of "o"s (e.g. fooooooo) if it's a regular expression. How does Adblock know which type of expression is in use?
But never mind those specific issues, surely there is a page somewhere that properly explains the wildcard/regular expression syntax for Adblock. If so, please tell me where.
Filter wildcard and/or regular expression syntax
Re: Filter wildcard and/or regular expression syntax
regular exp (between slashes):
normal wildcard:
/ads/ => regular filter
/ads/* => normal filter
Read the posts here:
forum/viewtopic.php?p=60384#p60384
Code: Select all
/\.sharesix\.com/.*[a-zA-Z0-9]{4}/$script
Code: Select all
||ww1.vidzi.tv^*.js|$domain=vidzi.tv
/ads/* => normal filter
Read the posts here:
forum/viewtopic.php?p=60384#p60384
Re: Filter wildcard and/or regular expression syntax
Thanks. So the forward slash denotes the regular expression and/or denotes the directory structure in the URL. Well, I guess I'll find my way through the logic by testing the filters to see if they do what I want.
Re: Filter wildcard and/or regular expression syntax
Actually I still don't get it. Say I wanted to block an element like so:
###u_0_3u
but I also wanted to block elements u_0_3s and u_0_3t etc, then what do I do?
###/u_0_3[a-z]/ doesn't seem to work
###/u_0_3.*/ doesn't seem to work
###u_0_3* doesn't seem to work either
So I don't know.
###u_0_3u
but I also wanted to block elements u_0_3s and u_0_3t etc, then what do I do?
###/u_0_3[a-z]/ doesn't seem to work
###/u_0_3.*/ doesn't seem to work
###u_0_3* doesn't seem to work either
So I don't know.
Re: Filter wildcard and/or regular expression syntax
No, you cannot use regular expressions in the normal hiding filters.
If you read again the filters page, you can use regular expressions only in the extended emulation hiding filters
en/filters#elemhide-emulation
If you read again the filters page, you can use regular expressions only in the extended emulation hiding filters
en/filters#elemhide-emulation