Simple example: porteus.org ends up in a blanket blacklist, so wish to whitelist everythinng porteus except for strings with 'mchat', using an RE, as 'mchat' quite often throws browser into tight loop.
Would be grateful for an elegant solution.

Code: Select all
(?!^mchat$)(^.*$)
Using Silent Block, an excellent Moz Add-on from Japan. On the one hand there is a blacklist, which is processed first, before the whitelist. All matches are REGEX. You have no idea the amount of rubbish that gets logged as blocked. Not having the luxury of 8 processors, have to protect single cpu from onslaught of scripts, So had already blocked doubleclick.net long before it achieved NSA notoriety. 8) After instituting blocks was amazed by the almost instantaneous nature of system responses. Final RE in my blacklist is now '\.js$'brokenman wrote:Any particular reason you need a REGEX for this? Depending on the tool you are using there may be other more elegant ways.
Thanks, I'll try that.brokenman wrote:In any case with a REGEX you could use negative look ahead.Code: Select all
(?!^mchat$)(^.*$)
In trying to understand suggested RE, trawled the Net for 'look ahead'. Came across cookkbook recipe for excluding strings containing a certain substring, in this case 'invalid':brokenman wrote:In any case with a REGEX you could use negative look ahead.Code: Select all
(?!^mchat$)(^.*$)
Code: Select all
^(?!.*invalid.*).*
i.e. if something is not followed by something else we have a match.Wisdom of the Web wrote:Negative look ahead is used to match something not followed by something else.
Code: Select all
usa: no match
eu: match
Code: Select all
usa: no match
eu: match
Code: Select all
No match: http://archive.linuxfromscratch.org/lfs-museumchat/2.3.1/LFS-BOOK-2.3.1-HTML/index.html
Match: http://media7.fast-torrent.ru/media/js/jquery-ui-1.10.3.custom1.min.js
Code: Select all
Match: http://archive.linuxfromscratch.org/lfs-museumchat/2.3.1/LFS-BOOK-2.3.1-HTML/index.html
Match: http://media7.fast-torrent.ru/media/js/jquery-ui-1.10.3.custom1.min.js
Code: Select all
No match: http://forum.porteus.org/mchat/jquery_cookie_mini.jsg/styles/prosilver/template/forum_fn.js
Match: http://forum.porteus.org/styles/prosilver/template/forum_fn.js
Match: http://forum.porteus.org/chat/jquery_cookie_mini.jshttp://forum.porteus.org/styles/prosilver/template/forum_fn.js
Code: Select all
No match: http://forum.porteus.org/mchat/jquery_cookie_mini.js
Match: http://forum.porteus.org/styles/prosilver/template/forum_fn.js
Match: http://forum.porteus.org/chat/jquery_cookie_mini.jshttp://forum.porteus.org/styles/prosilver/template/forum_fn.js
Code: Select all
SilentBlock: /\.js$/i
blocked http://forum.porteus.org/mchat/jquery-1.5.0.min.js
SilentBlock: /\.js$/i
blocked http://forum.porteus.org/styles/prosilver/template/forum_fn.js
but unblocked by /porteus\.org(?!.*mchat)/i