Form validation rules for regex_match

后端 未结 3 951
礼貌的吻别
礼貌的吻别 2020-12-10 17:02

I\'m trying to figure out what I\'m doing wrong with this validation rule because its saying this error.

Validation rule:

$this->form_validation-&         


        
3条回答
  •  盖世英雄少女心
    2020-12-10 17:34

    php's preg_match wants your regular expression surrounded by a non alpha-numeric character (usually everyone uses /), change your setRules() to this:

    $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean|regex_match[/a-z0-9/]');
    

提交回复
热议问题