Custom Filter
Custom filter is a module that allows you to create your own filters based on regular expressions. When you need some input filter that is not available from drupal.org/project/modules, and you don't want to write your own module, you can create your own filter with this module. What you need is regular expressions, and optionally PHP programming ability.
How it works
Custom Filter module provides filters to be used in Input Formats. A filter is a collection of one or more replacement rules. A replacement rule is a find-replace mechanism that has two main parts: Pattern to tell Drupal about the pattern to be found, and replacement text to tell what text to be used as replacement. The replacement text can be a plain text or a PHP Code.
There is a change in terminology used in Custom Filter 6.x:
- Filter (6.x) is used to be called Filter Set (5.x-1.x), and
- Replacement Rule (6.x) is used to be called Filter (5.x-1.x).
The reason behind this change is for consistency with Drupal terminology. As in Input Formats, we are asked to choose the filters that will be used, it is better to use the term filter instead of filter set.
Getting started
- To install this module, simply extract this module into module directory in your drupal installation (e.g. sites/all/module/customfilter).
- Enable this module from module administration.
- This module is available in Input Formats (/admin/settings/filters) under Site Configuration menu (6.x-1.x-dev). This menu path might be changed in the future version.
- If necessary, set this module's permission for some users.
- It is recommended to import customfilter_sample.xml to understand how this module works.
Todo
These features will be added in the near future:
- 3 kind of replacement method:
- Text with reference to n-th matched string:
<strong>$1</strong> - PHP function with return statement:
return '<strong>'. strtoupper($matches[1]) .'</strong>'; - PHP code mixed with HTML like this:
<strong><?php print $matches[1]; ?></strong>
- Text with reference to n-th matched string:
- Custom form that will be shown in Input Format configuration settings. Values entered in this form will be available through accessing variable $vars from replacement text. I still wondering how is the most efficient way to implement this.

Convert older HTML-Pages
This is really a great idea! Thank you very much!
I have existing HTML-Pages in an older website with tags I don't want to take with me in my new drupal site. I considered to learn how to develop filters to do this task. Now I can use the time for my new website, because this can be done easily with Custom Filter.
A. Gutenkunst