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 was called Filter Set.
  • Replacement Rule was called Filter.

The reason behind this change is for consistency with Drupal terminology.

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 the site configuration menu (6.x-1.x-dev). This menu path might be changed in the future version.
  • Set the permissions used from this module for the roles you want to be able to create filters with this module.

Creating filters

To create a Custom Filter, you can do these steps:

Some simple (but useful) examples

This page is a collection of simple replacement rules you can use for yourself. Before you can use any of this, you should have a filter as

Guide maintainers

arhip's picture