Include and exclude rules
The script will execute if it matches any include rule, as long as it does not match an exclude rule.
Include and exclude rules support the
* or globbing operator.
* serves as a wildcard that matches one or more of any character.
A rule can have several wildcards or none, in which case the rule must match the entire URL exactly.
Exclude rules look the same, and prevent the script from being executed.
http://www.example.com/foo/* will match:
// ==UserScript== // @include http://www.example.com/foo/* // @include http://www.example.org/*.bar // @exclude http://www.example.com/foo/baz // ==/UserScript==
If no include rule is provided,
@include * is assumed.
That is: every URL will be matched, within the allowed Greaseable schemes.
Support for full regular expressions in include and exclude rules is also available.
If the rule both starts and ends with a forward-slash (
/) character, the contents inside those slashes are interpreted as a regular expression.
// ==UserScript== // @include /^https?://www\.example\.com/.*$/ // @include /^http://www\.example\.(org|net)// // ==/UserScript==
new RegExp(), so you do not need to escape forward slashes inside the rule. Special regex characters (like
.) should still be escaped, as in the above examples; otherwise they have their normal regex meaning (like
.matching any non-newline character).
- The rule is always treated as case insensitive.
- Anchors (
$) are not supplied for you. If desired, they should be used as in the above example.
Greasemonkey will run scripts only on documents loaded from particular schemes. By default, those are:
User scripts will not run on documents from any other scheme (ftp, file, etc.) or any other part of about.