There are four types of rules:
@exclude in Ace Script.
It is recommended to use
@exclude-match rather than
@exclude because the match rules are safer and more strict.
@match defines a URL matching rule.
@exclude-match defines a match rule but used to exclude the matched URLs, similar to
For more details, see Match Patterns for Chrome extensions.
Note that match patterns only work on scheme, host and path, i.e. match patterns always ignore query string and hash.
Since Ace Script v2.10.4, some additional rules are accepted:
- the scheme part accepts
- the host part accepts wildcards (
*) at any position, e.g.
- the host part accepts
.tldto match any top level domain suffix.
// @match *://*/* // @exclude-match *://*.tk/*
@exclude rule can be one of the following:
a normal string
If the string does not start or end with a slash (
/), it will be used as a normal string.
If there are wildcards (
*), each of them matches any characters.
https://www.google.com/*matches the following:
but not the following:
If there is no wildcard in the string, the rule matches the entire URL.
The host part accepts
.tldto match top level domain suffix.
a regular expression
If the string starts and ends with a slash (
/), it will be compiled as a regular expression.
/\.google\.com[\.\/]/matches the following:
// @include * // @include https://www.google.com/* // @include /\.com\.hk\// // @exclude https://www.google.com/exact/url
In short, a script will execute if it matches any
@include rule and does not match any
Here is the long version:
- If any
@excluderule matches, the script does not match.
- Otherwise if any
@matchrule is defined, the script matches only if some of the
- If no
@matchrule is defined, we fallback to
@includerules and the script matches only if some of the
- If neither
@includerule is defined, the script is assumed to match.