@include and @exclude problem depending on the number of subfolders in URL

31 views
Skip to first unread message

Ben Stover

unread,
Apr 15, 2017, 1:22:09 AM4/15/17
to Greasemonkey Users
I have to setup two GM scripts which are reponsible for two kind of webpages from one domain depending on the number of subfolders after the domain part.

GM script 1 should be applied to all URLs which contain exactly TWO subfolder. Examples (mind the trailing slashes):

http://www.foobar.com/aaa/bbb/

or

http://www.foobar.com/aaa/ccc/

On the opposite GM script 2 should be applied to all URLs which consist of MORE than two (=at least three) subfolders after the URL. Examples:

http://www.foobar.com/aaa/ddd/eee/

or

http://www.foobar.com/aaa/ccc//fff/ggg/kkkk/

or

http://www.foobar.com/bbb/ddd/eee/fff/ggg/hhh.html



How setup the corresponding GM script headers with @include and @exclude?

The following does NOT work:

// @include http://*.foobar.com/*/*/*

matches ALL type of webpages.

Furthermore

// @include http://*.foobar.com/*/*/
// @exclude http://*.foobar.com/*/*/*

matches NONE.

How else can I setup a pattern "at least one char after the two leading sunfolders?

Thank you
Ben








Reply all
Reply to author
Forward
0 new messages