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
Post a Comment