It looks like you're new here. If you want to get involved, click one of these buttons!
$this->validator->add_rule('confirm_password', 'trim|required|xss_clean|matches[password]', 'The passwords do not match', $this->input->post('confirm_password');
$this->validator->add_rule('confirm_password', 'trim|required|xss_clean|is_equal_to', 'The passwords do not match', array($this->input->post('confirm_password'), 'password'));
$this->validator->add_rule('password', 'trim|required|xss_clean|alpha_dash', 'Please enter in a valid password', $this->input->post('password'));
Comments
$this->validator->add_rule('email', 'valid_email', 'Please enter in a valid email', $this->input->post('email')); $minLength = $this->config->item('password_min_length', 'tank_auth'); $minLengthMsg = "The password should be at least $minLength long."; $this->validator->add_rule('password', 'length_min', $minLengthMsg, array($this->input->post('password'), $minLength)); $maxLength = $this->config->item('password_max_length', 'tank_auth'); $maxLengthMsg = "The password should not be longer than $maxLength long."; $this->validator->add_rule('password', 'length_max', $maxLengthMsg, array($this->input->post('password'), $maxLength)); $this->validator->add_rule('password', 'regex', 'The password can contain only numbers, letters, underscores or dashes', array($this->input->post('password'), '/^([-a-z0-9_-])+$/i')); $this->validator->add_rule('confirm_password', 'required', 'The passwords do not match', array($this->input->post('confirm_password'), 'password'));
$this->validator->add_rule('password', 'is_safe_character', 'The password can contain only numbers, letters, underscores or dashes', $this->input->post('password'));
Instead of the regex.