here’s my problem: I want to check if a user insert a real name and surname by checking if they have only letters (of any alphabet) and ‘ or – in PHP. I’ve found a solution here (but I don’t remember the link) on how to check if a string has only letters:
preg_match('/^[\p{L} ]+$/u',$name)
but I’d like to admit ‘ and – too. (Charset is UTF8) Can anyone help me please?
Looks like you just need to modify the regex: [\p{L}’ -]+