I want to validate a prename and surname for users to register at a worldwide social community.
I want to allow all these language-related special characters like ÄÖÜÀýéè
and a maximum of 3 prenames, all seperated with a space (if there are more than 1 prename).
Also no underscores should be allowed or other special chars, but minus (-) should be allowed.
That's all I can think of what should be allowed in a name. I don't know how it is in other countries than Germany, but here you can have up to 3 prenames and a surname can also have 2 words like "von Seidenfeld". Maybe you can also give me some more suggestions here, because I want to cover this name-validation-system for every full name around the world.
I also know I've to use RegEx, but I don't know how to allow only these conditions that I just wrote.
What I have so far:
if (!preg_match('/^(\pL+\s+)$/u', $value)) echo 'error';
or view here: http://regex101.com/r/tE0uQ5 (sadly doesn't work, no matches)