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-&
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/]');