Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Sodium 3.0.2 Minor update available for module sodium (3.0.2). Release: X-Frame-Options Allow-From webvisor.com 2.0.2 Minor update available for module xframe_allow_webvisor (2.0.2). Release: Swagger UI Info 2.0.2 Minor update available for module swagger_ui_info (2.0.2). Release: Contact Mail 2.0.4 Minor update available for module contact_mail (2.0.4). Release: BootBase 2.0.3 Minor update available for theme bootbase (2.0.3). Release: Synapse Theme 2.0.1 Minor update available for module syntheme (2.0.1). Release: synship 2.0.2 Minor update available for module synship (2.0.2). Release: URL Rewriter 1.0.0-alpha4 New alpha version released for module url_rewriter (1.0.0-alpha4). Usage Milestone: Term CSV Export Import Module term_csv_export_import crossed 1,000 active installs. Module Revived: Year/Month Widget 1.1.3 Module year_month_widget updated after 9 months of inactivity (1.1.3).

Custom filter

724 sites Security covered
View on drupal.org

This module allows you to create custom text filters using regular expressions. You can define your own filters to perform tasks like replacing text, creating custom tags, or even using PHP code for more advanced manipulations.

Overview

This module allows you to create content filter using regular expressions. Instead of creating a new module for each filter you need, now you can easily create and organize your own filters. Your filter will appear in the input format configuration page.

For a description of the regular expression syntax, see PCRE regex syntax; for a description of the modifiers, see Possible modifiers in regex patterns. If you know the syntax used by Perl regular expressions, see Differences From Perl.

Please read thedocumentation where you can see some examples of how to use the module.

Features

Instead of creating a new filter module for every filter you need, you can use this module for tasks like creating your own tags, replacing token values and all changes you need in the text.
You can use simple replacements or use php code to write more powerfull things(like use it to highligth code with geshi).

Supported versions

- The 2.0.x works Drupal 8 and Drupal 9.
- The 3.0.x works with Drupal 11. I will remove support for earlier versions.

Other notes

Because the strings used for the description and the help text of the custom filters are dynamic (i.e., taken from a database table), it is not possible to translate them through t().
There is a possible issue with preg_replace_callback() function used in this module. The default setting for memory is sometimes low, and it return an empty page, look at this issue(Empty body: preg_replace_callback() used on large textfields (like node body) will likely result in NULL return).

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Apr 2026
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
3.0.0-beta1 Pre-release 8–11 Apr 30, 2026