How to generate a custom Zend filter from a regular expression
-
14-12-2020 - |
Question
I want to realize a Zend_Filter that return the string replacing banks with underscore and remove all the characters not allowed in a regular expression.
Is that possible?
Solution
$filter = new Zend_Filter_PregReplace();
$filter->setMatchPattern(array(' ', '/regexForCaracterNotAllowed/'))
->setReplacement(array('_', ''));
This is how to use the Zend_Filter_PregReplace. What are the not allowed caracters?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow