Made to Order Software Corporation Logo

MO Regex filter: Main Page

1.2

Summary

Introduction to the MO Regex filter module
Requirements
Installation
Known issues & security
Errors generated by this module.
Copyright (c) 2009-2011 Made to Order Software Corp.

Introduction to the MO Regex filter module

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.

Note:
This filter is different from the existing Drupal module http://drupal.org/project/regex_filter because it better integrates in Drupal 6.x. Also it lets you add as many regular expressions as you need within one format without having to manage a long list of separate filters (which results in a faster/better overall solution.) The module is also well optimized using seperate include files as required.
Back to Summary

Requirements

This module does not have any special requirements.

Back to Summary

Installation

In order to install this module:

  • Extract the MO Regex filter tarball under sites/all/modules
  • Go to Administer -> Build site -> Modules and enable the module
  • Go to Administer -> Settings -> Input formats
  • Add a new format or edit an existing format
  • Select the MO Regex filter and Save
  • Come back (edit) in that same filter and now click on Configuration
  • Enter one or more regular expressions (one per line)

Then create a new node or edit an existing node, and test the expressions with the corresponding content.

Back to Summary

Known issues & security

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.

Back to Summary

Errors generated by this module.

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');
Back to Summary
Back to Summary

Copyright (c) 2009-2011 Made to Order Software Corp.

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.

Back to Summary
Documentation generated by Doxygen on Sat Mar 12 16:05:40 2011