Regular Expression in Formatter

There's instructions for PHP formatters here:

Probably something like this:

<?php namespace lib\core; 
function formatter_regexreplace($str, $pattern){ 
$retval = preg_replace($pattern, '', $str);
return $retval; 
} ?>

You would then use it in a data binding code view as:

somevalue.regexreplace('thepattern')

e.g.
somevalue.regexreplace('([0-9])')

to remove digits

1 Like