Twig PCRE Filters for Craft CMS
##Filters:
See also: PHP PCRE-Functions
##Examples:
Basics:
|preg_filter(pattern, replacement, limit)
|preg_grep(pattern)
|preg_match(pattern)
|preg_quote(delimiter)
|preg_replace(pattern, replacement, limit)
|preg_split(pattern)Please read the php docs for a more detailed explanation of all functions.
Usage:
{{ "This is a simple example."|preg_replace('/simple/', 'beautiful') }}will output:
This is a beautiful example.
##Install:
- Move the
twigpcredirectory into thecraft/plugins/directory. - Go to Settings -> Plugins and enable 'Twig PCRE Filters'.