Problem setting custom validation rules in Cakephp
I creating a custom validation rule in my cakephp model.
开发者_C百科'article' => array(
'rule' => '/^[a-z0-9#.,&; ]{2,255}$/i',
'required' => true,
'allowEmpty' => false,
'message' => 'Alphabets and numbers only(3,255).'
),
This works fine. But It stops working, throws a error in model, when I add forward slash [/]
. I can't understand why forward causes a problem.
I appreciate any help.
Thanks.
As stated in your other question, read about preg_match()
patterns in the php manual. This function is used internally in the framework.
精彩评论