Username Validation In Yii Model

From my sourcecode, I gave the information for username validation in yii framework.

<?php
class User extends CActiveRecord
{
    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }
	
    public function tableName()
    {
        return 'tbl_user';
    }
	
    public function rules()
    {
        array('username', 'match', 
                'pattern' => '/^[A-Za-z0-9_]+$/u',
                'message'=>'Username can contain only alphanumeric characters and hyphens(-).'
			),
        array('username','unique'),
    }
}
?>