You need to check the name and surname entered in the form, as well as a double surname, for example Irina Naro-fominskaja
Closed due to the fact that the essence of the issue is not clear to the participants Saidolim , Nick Volynkin ♦ , apelsinka223 , Aries , Alexey Shtanko 24 Sep '15 at 17:00 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
1 answer
Validating names and surnames is a bad idea . You will not achieve anything by this, except for irritating users when they need to enter something that does not pass the test of your “universal regular schedule”.
Turn to the classics:
So, for the good of all, I have compiled a list of assumptions that your system can probably make about people's names. All these assumptions are wrong . Try to at least reduce the list when you design the system next time.
- Each person has one canonical full name.
- Each person has one full name that he uses.
- At this point in time, each person has one canonical full name.
- At this point in time, each person has one full name that he uses.
- Each person has exactly N names, regardless of the value of N.
- Names fit in a certain number of characters.
- Names do not change.
- Names change, but only in certain limited cases.
- Names are in ASCII.
- Names are written in any one encoding.
- All names correspond to Unicode characters.
- Names are case sensitive.
- Names are not case sensitive.
- Sometimes names have prefixes or suffixes, but you can safely ignore them.
- Names do not contain numbers.
- Names can not be written in CAPITAL letters.
- Names cannot be written in lowercase letters.
- There is order in names. Selecting one of the record ordering schemes will automatically lead to a constant order among all systems if they all use the same ordering scheme.
- Name and surname necessarily different.
- People have a last name or something similar, common to relatives.
- The name of the person is unique.
- The name of the person is almost unique.
- Okay, okay, but the names are quite rare, so there are no million people with the same name and surname.
- My system will never deal with names from China.
- Or Japan.
- Or Korea.
- Or Ireland, Great Britain, USA, Spain, Mexico, Brazil, Peru, Sweden, Botswana, South Africa, Trinidad, Haiti, France, the Klingon Empire - all of these use “weird” schemes for names.
- The Klingon Empire was a joke, right?
- To hell with cultural relativism! People in my society, at least, have the same idea of ​​a generally accepted standard for names.
- There is an algorithm that converts names to one and the other without loss. (Yes, yes, you can do it, if the algorithm at the output returns the same as at the entrance, take yourself a medal).
- I can confidently assume that this dictionary of obscene words does not contain surnames.
- Names are given to people at birth.
- OK, maybe not at birth, but pretty soon after.
- Okay, okay, for a year or so.
- Five years?
- You're kidding, right?
- Two different systems, in which the name of the same person is indicated, will use the same name for it.
- Two different data entry operators, if given the name of a person, will necessarily enter the same character set, if the system is well designed.
- People whose names break my system are strange aliens. They should have normal, acceptable names, like (a sequence of hieroglyphs).
- People have names.
The list is by no means exhaustive. If you need examples of real names that refute any of these points, I’m happy to name them. You can add in the comments other items for this list of delusions, and send people a link to this list the next time they come up with a brilliant idea to make a database with the columns first_name and last_name.
- oneOriginal: Patrick McKenzie, Falsehoods Programmers Believe About Nick Volynkin ♦
\w+\s\w+(-\w+)?. I did not specifically limit the length of the name and surname, as I know a person with the name "Iya Em". - KoVadim