The MO Regex filter module was created by Made to Order Software Corporation.
This module is an easy to use filter that allows you to apply one or more Perl regular expressions to your content. Since it works as a filter, it can be used in a block, a node, comments, and any other data type that supports filters.
This module does not have any special requirements.
In order to install this module:
Then create a new node or edit an existing node, and test the expressions with the corresponding content.
This module runs perl regular expressions via PHP. It is possible to crash the perl library when an expression is too complex. There isn't a good way to detect such expressions and it will also depend on the size of the input data (i.e. buffer overflows are most certainly the cause of those crashes.)
For this reason, you really want to limit access to that filter to only administrators.
Note that making PHP crash on purpose can represent a security issue in your system. When a page using this module (or any other module that uses regular expressions) never appears or is only sent partially, you want to check your system and Apache logs and verify that the PHP script did not crash.
This module does not generate errors although the regular expressions may not be valid...
To test your expressions, if you are not sure whether they work, run PHP CLI (PHP console line interpreter.)
Starts it with:
php -a
Then enter expressions as in:
echo preg_replace('/a test/', 'working', 'this is a test');
http://www.m2osw.com/mo_regex_filter contact@m2osw.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.