PHPackages                             indigoviking/expressive - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. indigoviking/expressive

ActiveCraft-plugin[Templating &amp; Views](/categories/templating)

indigoviking/expressive
=======================

Adds PHP PCRE preg functions as Twig filters.

1.01(7y ago)14.7k[3 issues](https://github.com/IndigoViking/Expressive/issues)MITPHP

Since Dec 28Pushed 7y agoCompare

[ Source](https://github.com/IndigoViking/Expressive)[ Packagist](https://packagist.org/packages/indigoviking/expressive)[ RSS](/packages/indigoviking-expressive/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Expressive plugin for Craft CMS 3.x
===================================

[](#expressive-plugin-for-craft-cms-3x)

Adds PHP preg functions as Twig filters.

[![Screenshot](resources/img/plugin-logo.png)](resources/img/plugin-logo.png)

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation
------------

[](#installation)

To install the plugin, search for Expressive in the Plugin Store or follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require IndigoViking/expressive

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Expressive.

Expressive Overview
-------------------

[](#expressive-overview)

Adds PHP preg functions as Twig filters. [preg\_filter](http://php.net/manual/en/function.preg-filter.php)

[preg\_grep](http://php.net/manual/en/function.preg-grep.php)

[preg\_last\_error](http://php.net/manual/en/function.preg-last-error.php)

[preg\_match](http://php.net/manual/en/function.preg-match.php)

preg\_match\_first

[preg\_match\_all](http://php.net/manual/en/function.preg-match-all.php)

[preg\_quote](http://php.net/manual/en/function.preg-quote.php)

[preg\_replace](http://php.net/manual/en/function.preg-replace.php)

[preg\_replace\_callback](http://php.net/manual/en/function.preg-replace-callback.php)

[preg\_replace\_callback\_array](http://php.net/manual/en/function.preg-replace-callback-array.php)

[preg\_split](http://php.net/manual/en/function.preg-split.php)

Using Expressive
----------------

[](#using-expressive)

Twig will remove backslashes so double backslash your regex patterns.

### Filter

[](#filter)

`{{ entry.field|preg_filter(pattern, replacement, limit) }}`

### Grep

[](#grep)

`{{ entry.field|preg_grep(pattern) }}`

### Last Error

[](#last-error)

This filter returns the last error given on any preg function. The preg function to test with must be specified and the appropriate parameters needed for that function to work.

#### Testing preg\_filter

[](#testing-preg_filter)

`{{ entry.field|preg_last_error('filter', pattern, replacement, limit) }}`

#### Testing preg\_grep

[](#testing-preg_grep)

`{{ entry.field|preg_last_error('grep', pattern) }}`

#### Testing preg\_match

[](#testing-preg_match)

`{{ entry.field|preg_last_error('match', pattern) }}`

#### Testing preg\_match\_first

[](#testing-preg_match_first)

`{{ entry.field|preg_last_error('matchfirst', pattern) }}`

#### Testing preg\_match\_all

[](#testing-preg_match_all)

`{{ entry.field|preg_last_error('matchall', pattern) }}`

#### Testing preg\_quote

[](#testing-preg_quote)

`{{ entry.field|preg_last_error('quote', delimiter) }}`

#### Testing preg\_replace

[](#testing-preg_replace)

`{{ entry.field|preg_last_error('replace', pattern, replacement, limit) }}`

#### Testing preg\_replace\_callback

[](#testing-preg_replace_callback)

`{{ entry.field|preg_last_error('callback', pattern, callback) }}`

#### Testing preg\_replace\_callback\_array

[](#testing-preg_replace_callback_array)

`{{ entry.field|preg_last_error('callbackarray', pattern, limit, count) }}`

#### Testing preg\_split

[](#testing-preg_split)

`{{ entry.field|preg_last_error('split', pattern) }}`

### Match

[](#match)

`{{ entry.field|preg_match(pattern) }}`

### Match First

[](#match-first)

`{{ entry.field|preg_match_first(pattern) }}`

### Match All

[](#match-all)

`{{ entry.field|preg_match_all(pattern) }}`

### Quote

[](#quote)

`{{ entry.field|preg_quote(delimiter) }}`

### Replace

[](#replace)

`{{ entry.field|preg_replace(pattern, replacement, limit) }}`Example: Replace email addresses with mailto links: `{{ entry.field|preg_replace('/(\S+@\S+\.\S+)/', '$1')|raw }}`Adding the |raw filter will render the HTML.

### Replace Callback

[](#replace-callback)

`{{ entry.field|preg_replace_callback(pattern, callback) }}`

### Replace Callback Array

[](#replace-callback-array)

`{{ entry.field|preg_replace_callback_array(pattern, limit, count) }}`

### Split

[](#split)

`{{ entry.field|preg_split(pattern) }}`

Brought to you by [The Indigo Viking](https://www.theindigoviking.com)

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

2

Last Release

2736d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca21e3417b5626bc86ca5c34f2bbb642875e51c997a92a0935f3a7561ad34311?d=identicon)[IndigoViking](/maintainers/IndigoViking)

---

Top Contributors

[![IndigoViking](https://avatars.githubusercontent.com/u/37722046?v=4)](https://github.com/IndigoViking "IndigoViking (3 commits)")

---

Tags

cmsPCREpregexpressiveCraftcraftcmscraft-pluginpreg\_matchpreg\_filter

### Embed Badge

![Health badge](/badges/indigoviking-expressive/health.svg)

```
[![Health](https://phpackages.com/badges/indigoviking-expressive/health.svg)](https://phpackages.com/packages/indigoviking-expressive)
```

###  Alternatives

[wbrowar/guide

A CMS Guide for Craft CMS.

6154.6k1](/packages/wbrowar-guide)[nystudio107/craft-minify

A simple plugin that allows you to minify blocks of HTML, CSS, and JS inline in Craft CMS templates.

36466.3k34](/packages/nystudio107-craft-minify)[verbb/footnotes

Adds a footnotes feature to CKEditor fields and Twig templates.

213.5k](/packages/verbb-footnotes)[jalendport/craft-preparse

A fieldtype that parses Twig when an element is saved and saves the result as plain text.

1087.5k](/packages/jalendport-craft-preparse)[verbb/color-mixer

A set of Twig filters for modifying colors.

1321.1k](/packages/verbb-color-mixer)[vierbeuter/craft-footnotes

Adds a footnotes feature to CKEditor fields and Twig templates.

212.7k](/packages/vierbeuter-craft-footnotes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
