[eluser]Matalina[/eluser]
The regex string is not properly formatted
Code:
function regex_match($str, $regex)
{
if ( ! preg_match($regex, $str))
{
return FALSE;
}
return TRUE;
}
so I think you need to do
Code:
$this->form_validation->set_rules('name','Name','required|regex_match[/[a-zA-Z]|\s/]|xss_clean');
Tho that is only going to match the first character.
Code:
$this->form_validation->set_rules('name','Name','required|regex_match[/([a-zA-Z]|\s)+/]|xss_clean');
And if you add in extra characters it's still going to pass.
Code:
$this->form_validation->set_rules('name','Name','required|regex_match[/^([a-zA-Z]|\s)+$/]|xss_clean');
That should match only alpha characters and space.