Understanding masks
Masks are used to determine if a string matches specified pattern. Ad Annihilator uses masks for resource address recognition in
banner,
popup and
cookie filters
and for document and resource search
.
A mask is a single sequence of characters that describe multiple matching
strings at once. The mask serves as a template for matching a character pattern
to the string being searched. There are two categories of characters:
Note that mask characters are case-insensitive. For example
a*bc and A*Bc masks are equivalent.
Special characters
Special characters are listed in the following table:
| Character |
Meaning |
Example |
| * |
Matches any number of characters and can be
used anywhere in the character string |
sh* matches show shell and should
*soft.com matches microsoft.com and lithesoft.com
s*tion matches satisfaction and solution |
| ? |
Matches any single character |
r?t matches cat rat and bat |
| [ ] |
Matches any single character within the brackets |
t[ai]p matches tap and tip but not top |
| ! |
Matches any character not in the list |
t[!ai]p matches top but not tap or tip |
| - |
Matches any one in a range of characters |
b[a-e]g matches bad bbd bcd bdd and
beg |
The wildcard characters * (asterisk) ? (question mark) and [ (opening
bracket) can match themselves only if enclosed in brackets.
See Examples for more usage examples.
Ordinary characters
Ordinary characters are all characters that do not
belong to special characters. In the mask they
match only itself. For example "mouse" mask matches only string "mouse" as it
contains only ordinary characters.
Examples
Practical usage examples are detailed in the following table:
| Kind of match |
Mask |
Matches |
Does not match |
| Multiple characters inside the string |
ad*. |
ad. ad1. ad2. ad10. |
ad1 ad ab. |
| Multiple characters at the string start |
*banner |
10banner banner rotabanner |
banner10 bannernet |
| Multiple characters at the string end |
banner* |
banner banner10 bannernet |
10banner rotabanner |
| Special character |
a[*]b |
a*b |
aab |
| Single character |
?all |
call tall ball |
all allow |
| Range of characters |
ad[a-z] |
ada adb adc |
ad ad@ ad2 |
| Outside a character range |
[!a-p] |
4 @ z |
a b p |
| Single digit |
ad[0-9] |
ad0 ad1 ad2 |
ad adx |
| Not a digit |
ad[!0-9] |
ada adx |
ad5 ad8 ad |
| Complex mask (all banners which address contains "ad", an
arbitrary character and a digit) |
*ad?[0-9]* |
adx5.banner.com adv9.advert.com |
ad1.banner.com adxx.advert.com |
| Case-insensitive characters |
ad |
ad aD Ad AD |
bc BC |
|