Regular expression for validating name in java

You maybe don't have to allow all the things mentioned in Falsehoods Programmers Believe About Names, but you are excluding a LOT of people (any people named Jo, Al, Ed, Ty, etc; all O' Somethings, all Abigails, Amelias, Melanies, and so on (I got tired of listing names, it's just so many).The problem with "lolz just for fun" is that now this code is out here on this very search-engine-friendly site, just waiting to be copy-and-pasted by a novice coder who won't bother to read these comments on why it's pretty bad code or why the very idea behind it is unsound.Often, a large and complex regular expression is used to validate the syntax of a program.If the program code does not match the regular expression, the compiler knows that there is a syntax error within the code.

A whitespace character is a space, a tab, a carriage return, a newline or a form feed. Regular expressions are not limited to these predefined character classes.

Plus, we know that no modern culture uses patronymic naming and people in the same nuclear family must have the same last name, right?

Well, we can at least assume that people do not have single character names, right?

Personally, I would accept any input, do a length check (it should not be empty, and it should fit into the database), and that's it (for further input validation - if it's needed - I would use a web application firewall, or something similar to filter all input).

It will be really frustrating for users if they cannot enter their name, and thus have to make up a name.

And there are no names that use special characters, symbols, or apostrophes?

You must have an account to comment. Please register or login here!