php - allow alphanum space alongwith dot special character in validation -


 ->add('proposer_name', 'custom', [                     'rule' => array('custom', '/^[a-z0-9 ]*$/i'),                     'message' => __('only alphanumeric characters allowed')                 ]) 

this method using in server side validation name. want write eg. mr. abc def in name field. not allowing . in field. how should regex please help. working in cakephp 3.x.

just add dot inside character class (square brackets []). has no special meaning inside.

 ->add('proposer_name', 'custom', [                     'rule' => array('custom', '/^[a-z0-9 .]*$/i'),                     'message' => __('only alphanumeric characters allowed')                 ]) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -