Reputation: 411
I would like to disallow people to writing character "#" on my input how can I achieve it ?
Upvotes: 0
Views: 240
Reputation: 16455
As @guessimtoolate suggested, since if you want to disallow only the sharp-character, then it's best to simply filter it out. Filters are run before Validation, therefore your workflow is like this:
#
The Filter you wanna be using is the Zend\Filter\PregReplace
. In case you're providing your Filters/Validators via the provider-interface, then the array-notation should be the following (it's untested, so you may work around a little bit with it)
'filters' => array(
array('name' => 'Zend\Filter\PregReplace', 'options' => array(
'pattern' => '/#/',
'replacement' => ''
)
)
Upvotes: 1