I have a PHP script that is supposed to check for \"valid\" human names, but recently cracked against a name with a space, so we added spaces to our validator.
Rather th
Custom Regular Expression Validation
var $validate = array(
'name' => array(
'rule' => '/^[^%#\/*@!...other characters you don\'t want...]+$/',
'message' => 'Only letters and integers, min 3 characters'
)
);
This is too naïve an approach though, as you would have to blacklist almost the entire range of Unicode characters. You can pretty much only do whitelisting of basic latin characters plus common quirks like spaces and apostrophes. Any more than that and you'll fight an uphill battle you can't win. You may be able to create a reasonably good algorithm over time, but it will never be 100% foolproof. So either restrict your users to basic latin names (and hope not to alienate your audience) or skip the validation entirely*
.
*
Or invest a few years into developing an algorithm covering <100% of human names, working 99.9% of the time.