Extension:Whitelist Regex

What can this extension do?
If you have a private wiki, you may wish to made some groups of pages publicly readable. This extension extends the default MediaWiki Manual:$wgWhitelistRead option by allowing one to identify the whitelisted pages by their namespace and a regular expression. Thus allowing to made public either a whole namespace and/or some groups of pages, based on their title.

This work is based on Extension:Whitelist_Namespaces by User:Bawolff

Usage sample
Please note:
 * That the use of start and end  delimiters in the regular expression is strongly encouraged. Otherwise a partial match will be made. As an example,   will match   but not.
 * In all examples of this page, I use a bang as delimiter for the regular expression instead of the most usual slash  since the later will clash with some page titles – notably in sub-pages (and I find the use of a backslash to shield it both less readable and more error prone).

Download instructions
Please cut and paste the code found below and place it in. Note: stands for the root directory of your MediaWiki installation, the same directory that holds .

Installation
To install this extension, add the following to :

Configuration parameters
The global variable  holds an array with an entry for each namespace (identified by their numeric ID) handled by this extension. In its turn, each entry holds an array of PCRE regular expressions. Any page matching one of the regular expressions in the corresponding namespace entry will be read-whitelisted. Here are some examples:
 * Grant anyone read access to the pages  and   in the main  namespace. Please note that a space is used in Main Page, since the pattern is matched against the title text – not the DB key (i.e.: by using _ instead of space).
 * Grant anyone read access to the pages  and   in the main  namespace. Please note that a space is used in Main Page, since the pattern is matched against the title text – not the DB key (i.e.: by using _ instead of space).


 * Grant anyone read access to the  page in the   namespace.
 * Grant anyone read access to the  page in the   namespace.


 * Grant anyone read access to any sub-page of  in the   namespace.
 * Grant anyone read access to any sub-page of  in the   namespace.


 * Grant anyone read access to any page in the namespace whose id is 202 (but not to the corresponding talk pages).
 * Grant anyone read access to any page in the namespace whose id is 202 (but not to the corresponding talk pages).