[Greasemonkey] Control over metadata include/exclude regular expressions

Bill Donnelly donnelly at snowcrest.net
Thu Dec 8 01:13:41 EST 2005


Nevermind.

A 'simple' regex of /adirectory/ doesn't make sense because
it will be converted into ^/adirectory/$, which isn't valid. 
(Gm-metadata-URL-wise)
(it would need to be: */adirectory/*, which becomes: ^.*/adirectory/.*$)

So it is safe to use both an "^" and a "/" as a first character
to specify 'complex' regular expressions.

So I made it now support both types of 'complex' regex's.

1)  ^.....$[\TLD]

2) /...../[iT]

Where items in [] are optional. On the second version, it you don't
specify a flag, it defaults to "i". (as usual ==> ignore case)
The T flag MUST be capitalized and is special for TLD support.

While I was at it, I added "**" to simple regex, which is
translated to ".+" (one or more characters, where ".*" means zero or more)

I tested it, so it should be fine.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: convert2RegExp.js
Type: application/x-javascript
Size: 12252 bytes
Desc: not available
Url : http://mozdev.org/pipermail/greasemonkey/attachments/20051208/9e20c157/convert2RegExp-0001.js


More information about the Greasemonkey mailing list