This simple filter plugin for Mephisto provides access to the String#gsub method in Liquid templates allowing you to easily perform string replacements.
Requirements
Mephisto Edge is required as the latest stable 0.7.3 release does not have support for Mephisto plugins.
Google Code
We have a wiki page setup for this plugin within our Google Code project.
Installation
The plugin can be installed just like a regular Rails plugin:
script/plugin install http://thewebfellas-on-mephisto.googlecode.com/svn/mephisto_string_replace/trunk/
You will then need to restart your server.
Usage
After installation you can use the filter in your Liquid templates like this:
{{ article.title | string_replace: '\s+', '-' }}
In this example any whitespace in the article title will be replaced with a hyphen. Note that the regular expression is passed as a string (without being surrounded by forward-slashes).
Licence
The code is released under an MIT licence.