我有一个有效的注册/更新模型,我想扩展我的模型,所以我在密码字段中添加了一个正则表达式。我已经在线检查了正则表达式的工作原理,甚至我的客户端验证也显示它有效,但模型现在拒绝保存。我不确定为什么,有人可以帮我吗?
return array(
array('firstName, lastName, email, password', 'required'),
array('firstName', 'length', 'max'=>45),
array('lastName', 'length', 'max'=>80),
array('email', 'length', 'max'=>120),
// email must be valid email
array('email', 'email'),
// email must be unique
array('email', 'unique'),
// Regex for password
array('password','match', 'pattern'=>'/^[a-z0-9_-]{7,20}$/i',
'message'=>'The password must be between 7 and 20 characters
long'),
array('password', 'length', 'min'=>7, 'max'=>64),
array('date_modified', 'safe'),
array('active, date_modified', 'default', 'setOnEmpty' => true, 'value' => null),
array('id, first_name, last_name, email, pass, active, date_created, date_modified, live', 'safe', 'on'=>'search'),
);
谢谢
强尼