您的位置:首页 > 编程语言 > PHP开发

how to use regular expressions in yii

2014-03-20 22:59 609 查看
http://stackoverflow.com/questions/20455022/how-to-use-regular-expressions-in-yii

You can try to use
match
(CRegularExpressionValidator)
rule to validate the attribute value with the specific regular expression like:
public function rules() {
return array(
array('username, password', 'required'),
array(
'username, password',
'match', 'pattern' => '/^[\*a-zA-Z0-9]{6,14}$/',
'message' => 'Invalid characters in username or password.',
),
);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: